VolksForth/8080/AmstradCPC/TURTLE.SCR

1 line
9.0 KiB
Plaintext
Raw Normal View History

2022-08-18 11:29:55 +00:00
\ Turtle-Graphic UH 03Dec86 Dieses File enthaelt die Definitionen fuer eine LOGO-aehnliche Turtle-Grafik. (Siehe volksFORTH-Handbuch.) \ Turtle-Graphic 05Sep86 \needs Graphics include grafik.scr \needs sin include mathe.scr 1 $05 +thru \ Turtle Variables UH 05Sep86 Onlyforth Graphics also definitions | Variable direction &90 ( degrees ) direction ! | Variable pendown? pendown? on : heading ( -- deg ) direction @ ; : seth ( deg -- ) &360 mod direction ! ; : lt ( deg -- ) heading + seth ; : rt ( deg -- ) negate lt ; \ Turtle moves 10Oct86| : scale ( trig len -- len' ) &10000 */ &5 + &10 / ; : fd ( n -- ) heading cos over scale heading sin rot scale pendown? @ IF liner ELSE mover THEN ; : bk ( n -- ) negate fd ; : xcor ( -- x ) cursor@ drop ; : ycor ( -- y ) cursor@ nip ; : setx ( x -- ) ycor move ; : sety ( y -- ) xcor swap move ; ' move Alias setxy