Dune
WHAT IS IT?
People been askin' me what I been dune this summer. . .
I modified the turmites program for this, altering the colors and invisibling the turtles. I also have constrained the turtles' direction by calling 'seth' before their walk is wiggled by the call to the random function.
I thought that having Turmites trend in a general direction would result in the creation of something like a sand dune and I have not been disappointed.
HOW TO USE IT
The 'Set-up' button initializes the model based on the slider settings. '% Density' sets the density of the 'sand'. 'Number' is the number of agents. 'Rest' is how far an agent travels before putting down a piece of sand. 'direction' is the prevailing wind direction (or the bias in the direction that the agents travel).
THINGS TO NOTICE
How does increasing the 'Rest' slider impact the patterns of the dunes ? Notice that you can change the values of several of the slides as the program is running ('Rest' and 'direction').
EXPLORATIONS
Things to play with: replace 'screen-width' in the Observer code with '(random 60),' the result is quite fun to watch. Play with the values and uses of the rest variable. It appears twice in the Turtles Procedures, and the original values were three in the first instance and ten in the second.
Have fun!
Turtle procedures
to go
blow ; wind (hidden turtles)
Carry ; picks up grains (well, alters patch colors anyway)
Drop ; and puts them back down on the downwind side
end
; This is basically the Turmite program, with hidden turtles and
; a heading constraint.
to blow
wiggle ; Turtle is empty, walks until finds a black patch, picks it up.
if pc = black [stamp white repeat rest [wiggle] stop]
blow
end
to carry
wiggle ; Turtle has a grain, walks until finds another grain.
if pc = black [stop]
carry
end
to drop
wiggle ; Turtle drops grain on next white patch, walks away and takes a breather.
if pc = white [stamp black repeat rest [wiggle] stop]
drop
end
to wiggle
seth direction ; value from slider
rt (random 40) - 20 ; some wiggle
fd 1
end
Observer procedures
To Set-up
ca ; Clear everything.
ask-patches [ifelse (random 100) < density [setpc black] [setpc white]] ; set some patches black.
crt number ; Could have create-and-done but then no space for comment. ;)
ask-turtles [ht seth (random 360) jump (random screen-width) ] ; Hide and then Scatter turtles
end
