EasyManua.ls Logo

AMSTRAD CPC464 - Page 109

AMSTRAD CPC464
249 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
This graphics demonstration plots a different coloured interference pattern:
new
10 a$=INKEY$: REM PRESS ANY KEY TO
INITIATE A NEW PATTERN SEQUENCE
20 IF a$="" THEN 10
30 CLS
40 m=INT(RND*3):REM SELECT A RANDOM
NUMBER BETWEEN 0 AND 3
50 IF m>2 THEN THEN 40: REM TRY AGAIN
IF THE VALUE EXCEEDS 2
60 MODE m
70 i1=RND*26:REM SELECT RANDOM INK VALUES
80 i2=RND*26
90 IF ABS(i1-i2)<5 THEN 70
100 INK O,i1:INK l,i2
110 s=RND*5+3 s=RND*5+3
120 ORIGIN 320,-100
130 FOR x= -1000 TO 0 STEP STEP s
140 MOVE 0,0
150 DRAW x,300:DRAW 0,600
160 MOVE 0,0
170 DRAW -x,300: DRAW 0,600
180 a$=INKEY$
190 IF a$<>"" THEN THEN 30:REM INTERRUPT
THE LOOP BY PRESSING ANY KEY
200 NEXT x
210 GOT0 10
This and the preceding program illustrate simple mathematical concepts in a colourful and very
visual way. Both are basically doing some sums on randomly generated seed numbers to ensure
that each pattern is different in some way, and displaying the results as random lines.
Your CPC464 is excellent electronic graph paper, and one of the most classic geometrical patterns is
a sine wave:
10 REM DRAW SINE WAVE
20 MODE 2
30 INK 1,21
40 INK 0,0
50 CLS
60 DEG
70 ORIGIN 0,200
80 FOR n=0 TO 720
90 y=SIN(n)
100 PLOT n*640/720,198*y,l
110 NEXT

Table of Contents

Other manuals for AMSTRAD CPC464

Related product manuals