12. Example Programs
10 REM LISSAJOUX 1
20 MODE 1
50 FOR F=0 TO 4 STEP 0.2
60 MOVE 640,912
70 A=0
80 REPEAT
90 A=A+0.1
100 DRAW 400*SIN(A)+640,400*COS(A*F)+512
110 UNTIL INKEY(0)=32
120 CLG
130 NEXT
140 END
10 REM LISSAJOUX 2
20 MODE 1
40 B%=RND(5)
50 C%=RND(5)
60 FOR A=0 TO 1000 STEP PI/30
70 X%=250*COS(A)
80 MOVE X%+640,X%+512
90 DRAW 500*COS(A/B%)+640,500*SIN(A/C%)
100 NEXT
10 REM C-CURVE
20 MODE 0
30 MIN%=12
40 MOVE 300,200
50 PROCC (200,0)
60 REPEAT UNTIL FALSE
70 DEFPROCC (L%,ANGLE)
80 IF L%<MIN% THEN PLOT1,L%*COS(ANGLE), L%* SIN (ANGLE) : ENDPROC
90 L%=L%/SQR(2)
100 PROCC (L%,ANGLE+PI/4)
110 PROCC (L%,ANGLE-PI/4)
120 ENDPROC
10 REM TOWER OF HANOI
20 INPUT "NUMBER OF DISCS ",F
30 PROCHANOI (F,1,2,3)
40 END
50 DEFPROCHANOI (A,B,C,D) IF A=0 ENDPROC
60 PROCRANOI (A-l, B, D, C)
70 PRINT "MOVE DISC ";A;" FROM PILE ";B; TO PILE ";C
80 PROCRANOI (A-1,D,C,B)
90 ENDPROC
Next
Chapter