HiLogo Source Code

^DEMO1
CS  SAY [Random wheels]
TELL 1
REPEAT 20 [SETPC PICK 15  randpos [wheel (PICK 50)+24 12]]
.
^WHEEL radius spokes
IF spokes<4 [say [Not enough spokes! (min=4)] STOP]
IF spokes>90 [say [Too many spokes! (max=90)] STOP]
LOCAL angle
MAKE angle 180/spokes
IF frac(angle)<>0 [say join join [Cannot draw] spokes [spokes!] STOP]
LOCAL len
MAKE len (radius*2)*sin(angle)
REPEAT spokes [fd radius rt 105 fd len bk len lt 105 bk radius rt angle*2]
.
^RANDPOS action
LOCAL x
LOCAL y
MAKE x PICK(401)-201
MAKE y PICK(201)-101
MOVEX x
MOVEY y
RUN action
MOVEX -x
MOVEY -y
.

Go To: HiLogo