Jebel Sahaba Model 1 - equal resource distribution + cows

Jebel Sahaba Model 1 - equal resource distribution + cows preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 71 times • Downloaded 7 times • Run 0 times
Download the 'Jebel Sahaba Model 1 - equal resource distribution + cows' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

globals [
  max-people
  max-arrows
]

breed [ people person ]
breed [ arrows arrow ]
breed [ cows cow ]

turtles-own [ energy ]
patches-own [ countdown ]

to setup
  clear-all


  ask patches [ set pcolor green ]



  create-people initial-number-people
  [
  set shape "person"
  set color black
  set size 1.5
  set energy random (2 * people-gain-from-food)
  setxy random-xcor random-ycor
  ]

  create-arrows initial-number-arrows
  [
    set shape "arrow"
    set color red
    set size 1.5
    set energy random (2 * arrows-gain-from-food)
    setxy random-xcor random-ycor
  ]

  create-cows initial-number-cows

 [
    set shape "cow"
    set color violet
    set size 1.5
    set energy random (2 * cows-gain-from-food)
    setxy random-xcor random-ycor
  ]
  reset-ticks
end 

to go

  if not any? turtles [ stop ]

  if not any? arrows and count people > max-people [ user-message "Agriculturalists won" stop ]
  if not any? people and count arrows > max-arrows [ user-message "Hunter gatherers won" stop ]

  ask people [
    move
    set energy energy - 1
      eat-grass
      eat-cows
      eat-arrows
      death
      reproduce-people
  ]


  ask arrows [
    move
    set energy energy - 1
    eat-grass
    eat-cows
    eat-people
    death
    reproduce-arrows
  ]

 ask cows [
    move
    set energy energy - 1
    eat-grass
    death
    reproduce-cows
  ]

 ask patches [ grow-grass ]

  tick
end 

to move
  rt random 50
  left random 50
  fd 1
end 

to eat-grass
  if pcolor = green [
    set pcolor brown
    set energy energy + people-gain-from-food
    set energy energy + arrows-gain-from-food
    set energy energy + cows-gain-from-food
  ]


  ifelse show-energy?
  [ set label energy ]
  [set label "" ]
end 

to reproduce-people  ;
  if random-float 100 < people-reproduce [
    set energy (energy / 2)
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to reproduce-arrows
  if random-float 100 < arrows-reproduce [
    set energy (energy / 2)
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to reproduce-cows
  if random-float 100 < cows-reproduce [
    set energy (energy / 2 )
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to eat-people
  let prey one-of people-here
  if prey != nobody  [
    ask prey [ die ]
    set energy energy + arrows-gain-from-food
  ]
end 

to eat-arrows
  let prey one-of arrows-here
  if prey != nobody [
    ask prey [ die ]
    set energy energy + people-gain-from-food
  ]
end 

to eat-cows
  let prey one-of cows-here
  if prey != nobody [
    ask prey [ die ]
    set energy energy + people-gain-from-food
    set energy energy + arrows-gain-from-food
  ]
end 

to death
  if energy < 0 [ die ]
end 

to grow-grass
  if pcolor = brown [
    ifelse countdown <= 0
      [ set pcolor green
        set countdown grass-regrowth-time ]
      [ set countdown countdown - 1 ]
  ]
end 

There is only one version of this model, created almost 3 years ago by Durr-e-Maknoon Tariq.

Attached files

File Type Description Last updated
Jebel Sahaba Model 1 - equal resource distribution + cows.png preview Preview for 'Jebel Sahaba Model 1 - equal resource distribution + cows' almost 3 years ago, by Durr-e-Maknoon Tariq Download

This model does not have any ancestors.

This model does not have any descendants.