DLA SOURCE CODE

Back to DLA


Turtle Procedures Observer Procedures
to setup 
setxy -1 + random 3 -1 + random 3 
place 
end 

to go
ifelse free 
[fd 1] 
[place]
end 

to free
rt random wiggle
lt random wiggle
ifelse sticky?
[output ((pc-at xcor ycor + 1) = black) and
   ((pc-at xcor ycor - 1) = black) and 
   ((pc-at xcor + 1 ycor) = black) and
   ((pc-at xcor - 1 ycor) = black) and
   ((pc-at xcor + 1 ycor + 1) = black) and 
   ((pc-at xcor + 1 ycor - 1) = black) and 
   ((pc-at xcor - 1 ycor + 1) = black) and 
   ((pc-at xcor - 1 ycor - 1) = black)]
 [output (pc-at xcor + dx ycor + dy) = black]
end

to go-simple 
ifelse free-simple 
  [fd 1] 
  [bk 1 place] 
end

to free-simple 
lt random wiggle 
rt random wiggle 
output pc = black 
end

to place
set particles particles + 1 
setc 15 + 10 * (round (particles / 500)) 
stamp color 
if sound? = 1 
[play-sound "drip"] 
ht 
setxy 0 0 
seth random 360 
fd screen-half-width 
st 
seth random 360 
end 

fd dist-2 
end 

to repel 
setrepel-turtle random total-turtles 
seth towards xcor-of repel-turtle ycor-of repel-turtle 
bk repel-strength / 100 
end

 

globals [particles] 

to setup 
ca 
set particles 0 
crt 25 
ask-turtles [setup] 
end