Hi Olga,
Now, that the SETTURTLE bug is removed, I modified a little bit your
end-rule for the 4bugs problem.
I attach an image of the final product.
============================================
to main ; 4bugs
frame_it ; code not shown
setpc[0 0 255] setup
move
end
to setup
setturtle 0 ht pu setxy -100 -100 pd
setturtle 1 ht pu setxy -100 100 pd
setturtle 2 ht pu setxy 100 100 pd
setturtle 3 ht pu setxy 100 -100 pd
end
to move
for[i 0 3][
setturtle remainder :i+1 4 make "loc pos
setturtle :i seth towards :loc fd 1]
if dist>1[move]
end
to dist
setturtle 0 localmake "b0 pos
setturtle 2 localmake "b2 pos
op sqrt sum(power((first :b0)-first :b2)2)~
(power((last :b0)-last :b2)2)
end
============================================
Enjoy,
[[Yehuda]
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home