Knights and Kings

No preview image

1 collaborator

Default-person Alexander Risman (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1.2 • Viewed 270 times • Downloaded 22 times • Run 1 time
Download the 'Knights and Kings' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

Ethnic conflict is an ongoing horror subplot in the story of the human race. From Holocaust remembrance month to the ongoing genocide in Darfur, it is something that is often on our minds and that continuously has to be dealt with. However, it appears to be possible that such tendencies may have actually initially evolved to counteract other evolutionary effects that gave human beings incentives to split into non-cooperative groups and not work as effectively together.

This is a model of an ancient land of knights, split into reds and blues. At first, they are all without lords, but being good knights, they seek out a someone to pledge their loyalty to. However, being good humans, they look out for their own interests, and if they see an opportunity to serve a lord with a greater following, they seize it. They are also capable of prejudice for their own kind, and violence, though these things are decided upon by the observer.

HOW IT WORKS

Each knight walks around aimlessly, looking for a lord to pledge his allegiance to. If he's not committed and runs into another knight, he pledges his allegiance to that knight. If he IS committed and runs into another knight, he compares that knight's following to his current lord's: if it's greater, he switches. This goes on until a king is crowned. However, knights can be prejudiced for following those of their own kind, and only pledge allegiance to them, and lords are capable of violence against other lords they view as potential threats.

HOW TO USE IT

The "percent-red" slider determines the percentage of knights that will be red, and the percentage that will be blue. The "there-can-be-only-one?" switch makes lords (knights with at least one follower) kill other lords they run into with less followers, and the "ethnic-rivalry?" switch makes the "leaders" of each race, or the member of that race with the most followers, kill the leader of the other if they happen to meet and the killer has more followers than the killee. The prejudice sliders set the level of prejudice for following one's own kind, with the number being the probability that each knight will only consider following a member of its own race at any given time.

THINGS TO NOTICE

If the switches are all off and the prejudice sliders are set to 0, notice how a king emerges every time, with every knight as a follower. If the prejudice is high for one race but not the other, that race will tend to produce the king, even if they're a minority. If the prejudice is high for both, they'll tend to split into ethnic groups each with its own leader, but eventually merge unless both prejudices are at 100 percent or only the prejudice for the minority is 100 percent. If prejudice is high for a minority, and the kill rival switches are turned on, far more members of that minority will die than if they are not prejudiced.

THINGS TO TRY

First, run the model with the switches off and prejudice sliders set to zero and see an undisputed ruler peacefully emerge. Next, set the percent-red slider to 40 and the red prejudice 100, and see a red king peacefully emerge. Next, set the percent red slider to 5 and the red prejudice to 100, and see a tiny red group and huge blue group, each with their own leader (except in very rare cases where red get lucky and manage to make a king). Next, set percent red 50 and prejudice for both groups 100, and see two equal, unconnected groups with their own leaders emerge. Next, set the percent red slider to 20, turn on the rival switches, and watch a fairly violent transition to a usually blue single leader occur. Next, keep the settings the same but turn red prejudice up to 100, and watch red either brutally take over Saddam Hussein style or get completely wiped out.

EXTENDING THE MODEL

Try making prejudice levels normally distributed across each knight, and making knights reproduce and die, seeing how prejudice levels evolve over time.

NETLOGO FEATURES

The "make-friends" procedure comes from a model of preferential attachment that is based on turtles having to "economize" on the number and kind of links they have, and that uses the concept of a "marginal friend" (called worst-friend in the procedures) to determine who to cut out of a network if a better opportunity arises.

RELATED MODELS

This is related to the RismanPreferentialAttachment model on Modeling Commons.

CREDITS AND REFERENCES

All of the code written by and ideas produced by Alex Risman, as far as he knows.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  king
  smith-leader
  john-leader
  ]

directed-link-breed [friendships friendship]

breed [smiths smith]

breed [johns john]

turtles-own [
  in-friends
  out-friends
  total-friends
  utility
  my-leader
]

to setup
  clear-all
  ask patches [set pcolor green]
  create-smiths percent-red
  create-johns 100 - percent-red
  ask turtles [
     move-to one-of patches
     set shape "person"
   ]
   ask smiths
   [set color red]
   ask johns 
   [set color blue]
end    

to go
   ask turtles[
  set out-friends count out-friendship-neighbors
  set in-friends count in-friendship-neighbors
  let total-friend-set (turtle-set in-friendship-neighbors out-friendship-neighbors)
  set total-friends count total-friend-set
  wiggle
  maintain-max
  update-turtles 
  ]
  ask smiths[
    make-friends-smith]
  ask johns[
    make-friends-john]
  if ethnic-rivarly?
  [kill-ethnic-rival]
  if there-can-only-be-one?
  [kill-all-rivals]
  update-globals
  tick
end  

to wiggle 
  rt random-float 360 fd 1
end 

to make-friends-smith
 let prospect ifelse-value (random-float 100 < red-prejudice)
 [one-of other smiths-here] 
 [one-of other turtles-here]
  if prospect != nobody
  [
    if out-friends < 1
  [create-friendship-to prospect]
  if out-friends = 1
  [let worst-friend min-one-of out-friendship-neighbors [total-friends]
    if worst-friend != nobody
    [
  if [total-friends] of prospect > [total-friends] of worst-friend
  [ask out-friendship-to worst-friend [die] 
    create-friendship-to prospect]]
  ]
  ]
end 

to make-friends-john
 let prospect ifelse-value (random-float 100 < blue-prejudice)
 [one-of other johns-here] 
 [one-of other turtles-here]
  if prospect != nobody
  [
    if out-friends < 1
  [create-friendship-to prospect]
  if out-friends = 1
  [let worst-friend min-one-of out-friendship-neighbors [total-friends]
    if worst-friend != nobody
    [
  if [total-friends] of prospect > [total-friends] of worst-friend
  [ask out-friendship-to worst-friend [die] 
    create-friendship-to prospect]]
  ]
  ]
end 

to maintain-max
  let worst-out-friend min-one-of out-friendship-neighbors [total-friends]
  let worst-in-friend  min-one-of in-friendship-neighbors [total-friends]
  if worst-out-friend != nobody
  [
    if out-friends > 1
  [ask out-friendship-to worst-out-friend [die] ]
  ]
  if worst-in-friend != nobody  
    [if in-friends > 100
    [ask in-friendship-from worst-in-friend [die] ]
    ]
end 

to update-globals
  set king one-of turtles with [total-friends = count turtles - 1]
  if count smiths > 0
  [
  ifelse king = nobody and [in-friends] of one-of smiths > 0 
  [set smith-leader max-one-of smiths [total-friends]]
  [set smith-leader nobody]
  ]
  if count johns > 0
  [  
  ifelse king = nobody and [in-friends] of one-of johns > 0 and count johns > 0
  [set john-leader max-one-of johns [total-friends]]
  [set john-leader nobody] 
  ] 
end   

to update-turtles
  set my-leader max-one-of (turtle-set out-friendship-neighbors self) [total-friends]
end 

to kill-ethnic-rival
  if ticks > 10 ;; without this delay, the model won't be able to run because none of the leaders will be defined
  [let smith-leaders (turtle-set smith-leader)
  let john-leaders (turtle-set john-leader)
  if smith-leader != nobody
  [ask smith-leader
  [ let rival one-of john-leaders with [xcor = [xcor] of self] with [ycor = [ycor] of self]
    if rival != nobody
    [if [total-friends] of self > [total-friends] of rival
      [ask rival
        [die]
      ]
    ]
  ]]
  if john-leader != nobody
  [ask john-leader
  [ let rival one-of smith-leaders with [xcor = [xcor] of self] with [ycor = [ycor] of self]
    if rival != nobody
    [if [total-friends] of self > [total-friends] of rival
      [ask rival
        [die]
      ]
    ]
  ]]
  ]
end 

to kill-all-rivals
  ask turtles
  [if my-leader = self and in-friends > 0 ;; letting rivals have no followers basically makes everyone kill everyone else 
    [let rival one-of other turtles-here with [my-leader = self and in-friends
        > 0] ;; see above comment
      if rival != nobody
    [if [total-friends] of self > [total-friends] of rival
      [ask rival
        [die]
      ]
    ]
    ]
  ]
end 

   





  
      
     

There is only one version of this model, created almost 13 years ago by Alexander Risman.

Attached files

No files

Parent: RismanPreferentialAttachment

This model does not have any descendants.

Graph of models related to 'Knights and Kings'