REM TURTLESTAR1.BAS --- タートルグラフィックスで星の輪郭を描く OPTION ANGLE DEGREES REM right(),left(),walk(),jump() REM 初期化 SUB init LET direction=0 LET xp=0 LET yp=0 END SUB REM 右に曲がる SUB right(t) LET direction=direction-t END SUB REM 左に曲がる SUB left(t) LET direction=direction+t END SUB REM s歩ジャンプする SUB jump(s) LET xp=xp+s*COS(direction) LET yp=yp+s*SIN(direction) PLOT LINES: xp,yp END SUB REM s歩進む SUB walk(s) PLOT LINES: xp,yp; CALL jump(s) END SUB REM ----------- start ------------ LET L=100 SET WINDOW -2*L,2*L,-2*L,2*L CALL init FOR i=1 TO 5 CALL walk(L) CALL right(144) CALL walk(L) CALL left(72) NEXT i END