Jacks vs Bears
Model was written in NetLogo 5.3.1
•
Viewed 258 times
•
Downloaded 39 times
•
Run 0 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
breed [saplings sapling] breed [trees tree] breed [elder_trees elder_tree] breed [jacks jack] breed [bears bear] saplings-own [age] trees-own [age lumber] elder_trees-own [lumber] globals [lumber_pieces maws!] to setup ca create_trees ini_trees create_jacks ini_trees * 0.2 create_bears ini_trees * 0.04 set lumber_pieces 0 set maws! 0 import-drawing "grass3.png" reset-ticks end to go if (count trees + count elder_trees + count saplings) = 0 or ticks = 4800 [ stop ] if count jacks < 1 [ create_jacks 1 ] activities_trees activities_animals tick if ticks mod 12 = 0 [ rh_jacks zoo ] end to activities_trees ask trees [ spawn 1 ages_tree ] ask elder_trees [ spawn 2 ] ask saplings [ ages_sapling ] end to activities_animals ask jacks [ move cut ] ask bears [ move maw ] end to create_trees [number] create-trees number [ move-to one-of patches with [not any? other turtles-here] setxy random-xcor random-ycor set color green set shape "tree_v2" set size 3 set age 0 set lumber 1 ] end to create_jacks [number] create-jacks number [ move-to one-of patches with [not any? other turtles-here] setxy random-pxcor random-pycor set color red + 3.5 set shape "jack_v2" set size 3 ] end to create_bears [number] create-bears number [ move-to one-of patches with [not any? other turtles-here] setxy random-pxcor random-pycor set color brown - 1 set shape "bear_v2" set size 3 ] end to move rt random 50 lt random 50 fd 1 end to spawn [number] let chance_to_spawn random 100 if chance_to_spawn < number and count (neighbors with [not any? other turtles-here]) > 0 [ hatch-saplings 1 [ move-to one-of neighbors with [not any? other turtles-here] set color green set shape "sapling_v1" set size 4 set age 0 ] ] end to ages_tree set age age + 1 if age = 120 [ hatch-elder_trees 1 [ set color green - 2 set shape "tree_v2" set size 3 set lumber 2 ] die ] end to ages_sapling set age age + 1 if age = 12 [ hatch-trees 1 [ set color green set shape "tree_v2" set size 3 set age 0 set lumber 1 ] die ] end to cut let find one-of trees-here if find != nobody [ ask find [ die ] set lumber_pieces lumber_pieces + 1 ] set find one-of elder_trees-here if find != nobody [ ask find [ die ] set lumber_pieces lumber_pieces + 2 ] end to maw let find one-of jacks-here if find != nobody [ ask find [ die ] set maws! maws! + 1 ] end to rh_jacks ifelse lumber_pieces >= count jacks [ let value int (lumber_pieces / count jacks) create_jacks value ] [ ask one-of jacks [die] ] set lumber_pieces 0 end to zoo ifelse maws! = 0 [ create_bears 1 ] [ ask one-of bears [die] ] set maws! 0 end
There is only one version of this model, created almost 9 years ago by Albano Borba.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
grass3.png | background | backgorund | almost 9 years ago, by Albano Borba | Download |
Jacks vs Bears.png | preview | Preview for 'Jacks vs Bears' | almost 9 years ago, by Albano Borba | Download |
This model does not have any ancestors.
This model does not have any descendants.