island

No preview image

1 collaborator

Default-person Pratim Sengupta (Author)

Tags

(This model has yet to be categorized with any tags)
Model group sced2690 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0beta4 • Viewed 183 times • Downloaded 22 times • Run 3 times
Download the 'island' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

breed [ humans human ]
breed [ humans2 human2]
breed [ plants plant ]
breed [ insects insect]
breed [ cows cow]
breed [ tigers tiger ]
humans-own [energy birth-energy]
cows-own [energy birth-energy]
humans2-own [energy birth-energy]
insects-own [energy birth-energy]
tigers-own [energy birth-energy]

to setup
  clear-all
  setup-environment
  setup-turtles 
  reset-ticks
end 

to setup-environment
  ask patches [set pcolor 65]
end 

to setup-turtles
  ask n-of initial-humans patches with [pcolor = 65] 
 [  sprout-humans initial-humans
    [ 
      set breed humans
      set color 32
      set shape "person"
      set size 3]
   ]
  ask n-of green-settlers patches with [pcolor = 65]
  [  sprout-humans2 green-settlers
    [
      set breed humans2
      set color 94
      set shape "person"
      set size 3]
  ]
  ask n-of initial-plants patches with [pcolor = 65]
  [  sprout-plants initial-plants
    [
      set breed plants
      set color 52
      set shape "plant"
      set size 2]
  ]
  ask n-of initial-insects patches with [pcolor = 65]
  [  sprout-insects initial-insects
    [
      set breed insects
      set color 125
      set shape "bug"
      set size 2]
  ]
  ask n-of initial-cows patches with [pcolor = 65]
  [  sprout-cows initial-cows
    [
      set breed cows
      set color 5
      set shape "cow"
      set size 2]
    ]
  ask n-of initial-tigers patches with [pcolor = 65]
  [ sprout-tigers initial-tigers
    [
      set breed tigers
      set color 43
      set shape "cat"
      set size 2]
  ]
end 

to go
  tick
  move-humans
  reproduce-humans
  move-cows
  reproduce-cows
  reproduce-plants
  move-humans2
  reproduce-humans2
  move-insects
  reproduce-insects
  move-tigers
  reproduce-tigers
  reproduce-plants
  move-plants
end 

to move-plants
    ask plants[ if random 360 < .5 [
    ask one-of plants in-radius 1 [die]
    ]
  ]
end 

to move-humans
  ask humans 
  [
   set heading random 360
   fd 1
   set energy (energy - 0.5)
   
   if any? plants in-radius 1 [
     ask one-of plants in-radius 1 [die]
     set energy (energy + 5)]

   if any? cows in-radius 1 [ 
    ask one-of cows in-radius 1 [die]
    set energy (energy + 10)]
   
   if any? tigers in-radius 3 [
     ask one-of tigers in-radius 3 [die]
     set energy (energy + 10)]
   
   if energy <= 1 [die]
  ]
end 

to move-humans2
  ask humans2
  [
    set heading random 360
    fd 1
    set energy (energy - 0.05)
    
    if any? plants in-radius 1 [
      ask one-of plants in-radius 1 [die]
      set energy (energy + 5)]
    
    if any? cows in-radius 1 [
      ask one-of cows in-radius 1 [die]
      set energy (energy + 10)]
    
    if any? tigers in-radius 3 [
     ask one-of tigers in-radius 3 [die]
     set energy (energy + 10)]
    
    if any? plants in-radius 1 [
      ask one-of plants in-radius 1 [hatch 2 fd 2]
      ]
    
    if energy <= 1 [die]
  
  ]
end 

to move-cows
  ask cows
  [
    set heading random 360
    fd 1
    set energy (energy - 2)
    
    if any? plants in-radius 1 [
      ask one-of plants in-radius 1 [die]
      set energy (energy + 5)]
    
    if any? insects in-radius 5 [
      ask one-of insects in-radius 5 [die]
      set energy (energy + 10)]
    
    if energy <= 1 [die]
  ]
end 

to move-insects
  ask insects
  [
    set heading random 360
    fd 3
    set energy (energy - 1)
    
    if any? plants in-radius 5 [
      ask one-of plants in-radius 5 [die]
      set energy (energy + 5)]
    
    if energy <= 1 [die]
  ]
end 

to move-tigers
  ask tigers
  [
    set heading random 360
    fd 2
    set energy (energy - 1)
    
    if any? cows in-radius 5 [
      ask one-of cows in-radius 5 [die]
      set energy (energy + 15)]
    
    if energy <= 1 [die]
  ]
end 

to reproduce-humans
  ask humans [
    set birth-energy energy / 4
    if energy > 200 [
      set energy energy / 4 
      hatch 1 [set energy birth-energy ]
    ]
  ]
end 

to reproduce-humans2
  ask humans2 [
    set birth-energy energy / 4
    if energy > 100 [
      set energy energy / 4 
      hatch 1 [set energy birth-energy ]
     ]
  ]
end 

to reproduce-cows
  ask cows [
   set birth-energy energy / 2
    if energy > 100 [
      set energy energy / 2 
      hatch 1 
    ]
  ]
end 

to reproduce-insects
  ask insects [
    set birth-energy energy / 2
    if energy > 50 [
      set energy energy / 2
      hatch 1 
    ]
  ]
end 

to reproduce-tigers
  ask tigers [
    set birth-energy energy / 2
    if energy > 100 [
      set energy energy / 2
      hatch 1 
    ]
  ]
end 

to reproduce-plants
  ask plants[ if random 360 < 1 [
    ask one-of plants in-radius 1 [hatch 1 fd 4 ]
    ]
  ]
end 

to add-ten-humans
create-humans 10 
[ set energy random 20 
  set shape "person" set size 2 
  set color 32
  setxy random-xcor random-ycor] 
end  

There is only one version of this model, created over 12 years ago by Pratim Sengupta.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.