Java StarLogo
2.0
english
`turtle`
to go 
   check-color
   wiggle
   fd 1
end

to check-color      ;move color block to current location
  if pc-ahead = red [make-black rt 180 stamp red]  
  if pc-ahead = green [make-black lt 90 stamp green]
  if pc-ahead = blue [make-black rt 90 stamp blue]
end


to make-black     ;makes the patch that the turtle is facing black
   fd 1 stamp black bk 1 
end


to random-move 
   seth random 360
   fd random 100
end


to wiggle
   rt random 10
   lt random 10
end



to square             ;the first turtle draws squares
   pd
   seth 0
   repeat 4 [fd 10 rt 90 fd 1 rt 90 fd 10 lt 90 fd 1 lt 90]
   fd 10 rt 90 fd 1 rt 90 fd 10
   pu
end


`observer`
to setup 
   ca
   crt 1 
   ask-turtles         ;draws three blocks at random positions on screen
   [random-move  
   setc red 
   square 
   random-move 
   setc blue
   square 
   random-move 
   setc green  
   square 
   setxy 0 0 ] 
   crt 9              ;9 more turtles created, bringing the total to 10
end


`information`
For use with the Adventures in Modeling book,  by Vanessa Colella, Eric Klopfer, and Mitchel Resnick published by Teachers College Press, 2001.  

For more information, see  
<http://education.mit.edu/starlogo/adventures>  

Challenge 4: Turtledozers  
This project is another variation of Bumper Turtles. 

Press "setup" to draw three randomly placed colored squares on the screen. If you want to, you can supplement these squares with additional drawings that you make using the Paint Tools. 

In Turtledozers the "check-patches" procedure has been modified so that when the turtles bounce off of an obstacle they drag a piece of it with them for one step. This turtle action disperses the obstacles. 

The three monitors keep track of the number of red, blue, and green patches. As the turtles disperse the obstacles, the number of colored patches eventually decreases. Why do you think that this happens?


`interface`
SLCanvas
top-left 13 209

SLMonitor
top-left 148 52
width-height 79 36
name "monitor2"
list-to-run "count-pc blue"
digits 0
delay 0.5
monitor-number 2
show-name? false
whichip 9
onewhichip 10

SLMonitor
top-left 192 52
width-height 79 36
name "monitor3"
list-to-run "count-pc green"
digits 0
delay 0.5
monitor-number 3
show-name? false
whichip 11
onewhichip 12

SLMonitor
top-left 103 52
width-height 79 36
name "monitor1"
list-to-run "count-pc red"
digits 0
delay 0.5
monitor-number 1
show-name? false
whichip 13
onewhichip 14

SLButton
turtle-or-observer? turtle
top-left 54 103
width-height 73 30
name "button1"
line-to-run "go"
forever? true
button-number 1
show-name? false
whichip 7

SLButton
turtle-or-observer? observer
top-left 53 14
width-height 73 30
name "button2"
line-to-run "setup"
forever? false
button-number 2
show-name? false
whichip 8


`turtle shapes`
[encoded data, 5330 characters]
qqqqqqqaoR8DO5wb3dkOFQAAFQ7Z

`template`
null

`settings`
patch-size 8
num-shapes 256
screen-half-width 25
screen-half-height 23
interface-window-xcor 268
interface-window-ycor 78
interface-window-size 661 413
output-window-xcor 0
output-window-ycor 0
output-window-width 300
output-window-height 219
info-window-xcor 97
info-window-ycor 138
info-window-width 500
info-window-height 419
control-center-xcor 0
control-center-ycor 85
control-center-width 285
control-center-height 415
turtle-command-center-height 150
observer-command-center-height 150

`string table`
H4sIAAAAAAAAAGNgYGAAABzfRCEEAAAAAAAABA==

`symbol table`
H4sIAAAAAAAAAGNgYGAAABzfRCEEAAAAAAAABA==

`double table`
H4sIAAAAAAAAAGNgYGBx0GMAA4coBwjt3QCm7R9AxAEul7BxJAAAAAAAACQ=

`list table`
H4sIAAAAAAAAAI2QSw6AMAhEh6mJ0YXer2sXHtADCmWIXdqEwJvyawEcAFYDjB4w
PZ0h28JZ4ilt5Lp/+OVVXZ/qQzNpITVLhvp5nt0eXBljD5vmLNK66vofRp6YRb2n
qT+nPRqT625w7ai/qLvBLwiqxIssAQAAAAABLA==

`bytecodes`
H4sIAAAAAAAAAKVUTW+CQBAdUFb5UDyIXyfTNunJW3vx1DTpsf9BxQ01KmsR2vQ/
tv+pyzKwK1K1cRPZZWbem3kzi2DPFl8x9dmS7mdP8J2uHwBwwdjTONnx4wMU64b/
NDwP6gB6ergHaKR7XcZp+PA66CPSVxmr/yO2Vh2rYazYDR5DRCjcErSRrGY3dfKM
AePPdimXXno3Svx8eQ5yaGD7b9RfT3y2YRH3vBwHYyO0brsQqnX6mMfGJLUKgUMp
qFvLQlxdikNBkrdxA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