Ever-Changing Mandala

Charlie Veniotย 26th September 2022 at 11:04pm
``````1 REM ** Ever-Changing Mandala **
2 ' BASED ON: GW-BASIC Made Easy, Chapter 12. File: GWME1211.BAS
100 REM ** Setup **
'โ 110 was SCREEN 1: COLOR 0, 1: CLS : KEY OFF
110 SCREEN _newimage(640,200,9)
120 RANDOMIZE TIMER: DEFINT A-Z
130 REM ** Draw mandala until ESC key is pressed **
'๐
_alert("Press the escape key to pause the program.\n\nWhen the program is paused, press the escape key again to end the program, or press any other key to resume the program.")
'โ 140 was CIRCLE (160, 100), 2, 3: PAINT (160, 100), 3, 3 'Center
140 CIRCLE (320, 100), 2, 3: PAINT (320, 100), 3, 3 'Center
150 WHILE INKEY\$ <> CHR\$(27)
160 ' Assign random values to variables
170 radius = INT(8 * RND) + 3
'โ 180 OneKolor = INT(3 * RND) + 1: TwoKolor = INT(4 * RND)
180 OneKolor = INT(15 * RND) + 1
'๐
if int(3*rnd) <> 0 then
TwoKolor = INT(16 * RND)
else
TwoKolor = 0
end if
190 DelH = INT(310 * RND) + 10 'Horizontal offset
200 DelV = INT(95 * RND) + 10 'Vertical offset
210 ' Draw and paint circles
'โ lines 220-290: x values all doubled
220 CIRCLE (320 + DelH, 100 + DelV), radius, OneKolor
230 PAINT (320 + DelH, 100 + DelV), TwoKolor, OneKolor
240 CIRCLE (318 - DelH, 100 + DelV), radius, OneKolor
250 PAINT (318 - DelH, 100 + DelV), TwoKolor, OneKolor
260 CIRCLE (318 - DelH, 99 - DelV), radius, OneKolor
270 PAINT (318 - DelH, 99 - DelV), TwoKolor, OneKolor
280 CIRCLE (320 + DelH, 99 - DelV), radius, OneKolor
290 PAINT (320 + DelH, 99 - DelV), TwoKolor, OneKolor
300 delay! = .125: start! = TIMER
310 WHILE TIMER < start! + delay!: WEND 'Pause
320 WEND
330 REM ** Check to see if more or quit **
340 ky\$ = INPUT\$(1): IF ky\$ <> CHR\$(27) THEN 150 'More or quit
'โ350 CLS: SCREEN 0: WIDTH 80: END
350 END``````