turtles-own
[inside]
to go
check-patches
fd 1
ifelse (pc = 15) or (pc =
115)
[setinside? true]
[setinside? false]
end
to check-patches
if pc-ahead = lime
[ifelse (random 2) = 0
[rt 90 check-patches]
[lt 90 check-patches]]
end
|
to init
clearplot
ask-turtles [die]
crt number
ask-turtles
[sety -8 setc 117 seth random
360 setinside? true]
setup-graph
end
to init2
ask-patches
[if pc = 115 [sprout [setc
117 setinside? true]]]
ask-turtles [seth random 360]
setup-graph
end
to setup-graph
pp1 ppreset setppc purple ppd
pp2 ppreset setppc black ppd
setplot-xrange 0 100
setplot-yrange 0 200
setplot-title "Diffused Turtles"
end
to graph
pp1 plot (count-turtles-with
[inside? = true])
pp2 plot (count-turtles-with
[inside? = false])
end
|