breed [hunters hunter]
breed [bisons bison]
bisons-own [grabbed?]
hunters-own [energy hunt?]
to setup
ca
create-bisons BisonCount
create-hunters HunterCount
ask patches [set pcolor green]
ask bisons [
set size 1.5
set color black
set shape "cow"
set grabbed? false
set xcor random 35 - 17
set ycor random 35 - 17]
ask hunters [
set size 1.5
set color white
set shape "person"
set energy random 10
set xcor random 35 - 17
set ycor random 35 - 17]
end
to wiggle
ask turtles [
rt random 45 - random 45
fd 1]
ask hunters [set energy energy - 1]
end
to birth
ask hunters [if(random 100 < 5)
[set energy energy / 2
hatch 1 [fd 1]]]
ask bisons [if (random 100 < 4)
[hatch 1 [fd 1]]]
end
to hunt
ask turtles [let p one-of bisons-here with [grabbed? = false]
if (p != nobody)
[ask p
[set grabbed? true
die
set energy energy + energyhunt]]]
end
to go
wiggle
birth
hunt
end
|
Results 1 to 20 of 22
Thread: homework
|



LinkBack URL
About LinkBacks








Reply With Quote




Bookmarks