Here’s an example of a program that uses all the items mentioned so far, and introduces a couple
more useful concepts. See how the first line (10) sets up the colour and ink conditions to make sure
that whatever was in the memory of the CPC464 at the time is reset to produce the expected results:
10 INK 0,0:INK 1,26:INK 2,6:INK 3,18:BORDER 0
20 REM this programs draws patterns
30 mode l:DEG
40 PRINT "3,4 or 6 sided pattern ? ";
50 LINE INPUT p$
60 IF p$=”3” THEN sa=120:GOTO 100
70 IF p$="4" THEN sa=135:GOTO 100
80 IF p$="6" THEN sa=150:GOTO 100
90 GOT0 50
100 PRINT:PRINT “Calculating”;
105 IF p$="3" THEN ORIGIN 0,-50,0,640,0,400
ELSE ORIGIN 0,0,0,640,0,400
110 DIM cx(5),cy(5),r(5),lc(5)
120 DIM np(5)
130 DIM px%(5,81),py%(5,81)
140 st=l
150 cx(l)=320:cy(l)=200:r(l)=80
160 FOR st=l TO 4
170 r(st+l)=r(st)/2
180 NEXT st
190 FOR st=l TO 5
200 lc(st)=0:np(st)=0
210 np(st)=np(st)+l
220 px%(st,np(st))=r(st)*SIN(lc(st))
230 py%(st,np(st))=r(st)*COS(Lc(st))
240 lc(st)=lc(st)+360/r(st)
245 IF (lc(st) MOD 60)=0 THEN PRINT ".";
250 IF lc(st) < 360 THEN 210
252 px%(st,np(st)+l)=px%(st,l)
254 py%(st,np(st>+l)=py%(st,l)
260 NEXT st
265 CLS:ink 1,2
270 st=l
280 GOSUB 340
290 LOCATE 1,1
300 EVERY 25,l GOSUB 510
310 EVERY 15,2 GOSUB 550
320 EVERY 5,3 GOSUB 590
530 GOT0 330
340 REM draw circle plus 3,4 or 6 others
around it
350 cx%=cx(st):cy%=cy(st):lc(st)=0
360 FOR x%=1 TO np(st)
370 MOVE cx%,cy%
/more