aUCBLogo Demos and Tests / 3drohre
be 3drohre
singleshot=Name? "framenr
if (not singleshot) or2 not name? "warda
[ perspective
setEye {0 0 600}{0 0 -1500}{0 1 0}
setLightAmbient rgb .2 .2 .2
cs
enableCylinderLines
enableRoundLineEnds
setPenSize [20 20]
setPC "red
Radius=200
Abstand=40
Nr=Int 2*Radius/Abstand
warda=(mdarray (List Nr Nr Nr)+10 -Int Nr/2+5)
Farbe=1
i=1
]
while [and not Key? i < 1000]
[ l=Abstand
PenUp
ok=false
i=1
until [(or ok Key? i > 10)]
[ fd l
ifelse or ((Norm PosXYZ) > Radius)
not empty? mdItem round PosXYZ/Abstand warda
[ back l
neueRichtung
i=i+1
][
back l
ok=true
]
]
ifelse ok
[ PenDown
setPC Farbe
fd l
mdSetItem round PosXYZ/Abstand warda Farbe
neueRichtung
][
PenUp
i=1
until [or (i > 1000)
and empty? mdItem round PosXYZ/Abstand warda
((Norm PosXYZ) <= Radius)]
[ setPosXYZ ((random Int (rSeq Nr Nr 3))-Int Nr/2)*Abstand
i=i+1
]
pr i
mdSetItem round PosXYZ/Abstand warda Farbe
neueRichtung
Farbe=mod Farbe+1 16
]
updateGraph
]
rotatescene
end
be neueRichtung
run sentence pick [right left up down] [90]
end