# adaptations

No preview image

Model was written in NetLogo 5.0beta4
•
Viewed 506 times
•
Downloaded 34 times
•
Run 3 times

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 [height energy lifespan] patches-own [countdown] to setup ca ask patches with [ pxcor <= (max-pxcor) and pxcor >= (min-pxcor) and pycor <= (max-pycor) and pycor >= (min-pycor + height-of-tree)] [set pcolor green] create-turtles 10 ask turtles [set color white] ask n-of 2 turtles with [color = white] [ set color red] ask n-of 2 turtles with [color = white] [ set color green - 3] ask n-of 2 turtles with [color = white] [ set color orange] ask n-of 2 turtles with [color = white] [ set color blue] ask n-of 2 turtles with [color = white] [ set color yellow] ask turtles with [color = red] [set height red-height] ask turtles with [color = green - 3] [set height green-height] ask turtles with [color = yellow] [set height yellow-height] ask turtles with [color = blue ] [ set height blue-height] ask turtles with [color = orange ] [ set height orange-height] ask turtles [setxy random-xcor -16 set heading 0 set energy 10 set size 1.5 set shape "bug" set lifespan 0] reset-ticks end to display-lifespan ask turtles [ set label "" ] if life-span?[ ask turtles [ set label round lifespan ]] end to go tick move if ticks mod 10 = 0 [update-plots] kick-the-bucket regrow-trees reproduce if life-span? [ask turtles [if lifespan > 40 [die]]] display-lifespan end to reproduce ask turtles [ if random-float 100 < 25 [ set energy (energy / 2) hatch 1 [setxy random-xcor -16 set heading 0 if mutations = 0 [ ifelse random 2 > 1 [set height height + 0] [set height height - 0]] if mutations = 1 [ ifelse random 10 > 5 [set height height + .05] [set height height - .05]] if mutations = 2 [ ifelse random 10 > 5 [set height height + .1] [set height height - .1]] if mutations = 3 [ ifelse random 10 > 5 [set height height + .2] [set height height - .2]] if mutations = 4 [ ifelse random 10 > 5 [set height height + .5 ] [set height height - .5]] if mutations = 5 [ ifelse random 10 > 5 [set height height + .7] [set height height - .7]] set lifespan 0]]] end to regrow-trees ask patches [if pcolor = brown [ ifelse countdown <= 0 [set pcolor green set countdown 10] [set countdown (countdown - 1 )]] ] end to eat-trees if pcolor = green [ set pcolor brown set energy (energy + 5) ] end to move ask-concurrent turtles [ fd height rt 180 eat-trees fd height rt 180 set energy energy - 1 rt 90 fd random (10) left 90 set lifespan lifespan + 1] end to kick-the-bucket ask turtles [if energy <= 0 [die]] end

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

## Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.