thing i did

No preview image

1 collaborator

Default-person Alex C-R (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 31 times • Downloaded 1 time • Run 0 times
Download the 'thing i did' 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

turtles-own [energy]

breed [eaten eaten1]
breed [eater eater1]

to setup
  clear-all
  setup-eaten
  setup-eater
  setup-grass
  reset-ticks
end 

to setup-eaten
  create-eaten 5 [set color 54]
  create-eaten 5 [set color 53]
  create-eaten 5 [set color 52]
  ask eaten [setxy random-xcor random-ycor]
  ask eaten [set shape "circle"]
  ask eaten [set energy 10]
end 

to setup-eater
  create-eater 10 [set color red]
  ask eater [setxy random-xcor random-ycor]
  ask eater [set shape "square"]
  ask eater [set energy 10]
end 

to setup-grass
  ask patches [set pcolor 10 - random 2]
  ask patches with [pcolor = 10] [set pcolor 33]
  ask patches with [pcolor = 9] [set pcolor 55]
end 

to go
  if not any? eaten with [color != 54] [ifelse End-After-Evolution-Is-Complete? [output-print "Natural Selection Complete" stop] []]
  go-eaten
  go-eater
  go-grass
  tick
end 

to go-eaten
  ask eaten [move eat-grass eaten-baby death move]
end 

to go-eater
  ask eater [move eat-eaten eater-baby death]
end 

to go-grass
  ask patches [grow-grass]
end 

to move
  right random 50
  left random 50
  forward 1
  set energy energy - .25
end 

to grow-grass
  if random 50 = 1 [set pcolor 55]
end 

to eat-grass
  if pcolor = 55 [set pcolor 33 set energy energy + 2]
end 

to eat-eaten
  let prey one-of eaten-here
  if prey != nobody [ask prey [if color = 54 [if random 10 = 1 [die]]] if random 10 = 1 [set energy energy + 8.5]]
  if prey != nobody [ask prey [if color = 53 [if random 2 = 1 [die]]] if random 2 = 1 [set energy energy + 8.5]]
  if prey != nobody [ask prey [if color = 52 [die]] set energy energy + 8.5]
end 

to eaten-baby
  if energy > 10 [if random 25 = 1 [hatch 2 [set color color set energy 5] set energy 5]]
end 

to eater-baby
  if energy > 10 [if random 25 = 1[hatch 1 [set color red set energy 5] set energy 5]]
end 

to death
  if energy <= 0 [die]
end 

There are 2 versions of this model.

Uploaded by When Description Download
Alex C-R 4 months ago Added option to let simulation continue and removed "Chaos Mode' Download this version
Alex C-R 4 months ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.