10 REM - Wandering CBS Eye EYESAVE2.BAS.txt

20 GOSUB 1000 : REM Clear the Screen
30 PI = 3.14159
40 DZOP "C",1 : REM Color mode [Range = 16-23]
50 XC = 128 : YC = 128 : REM Initial center of the Eye

60 REM Set initial colors for the CBS Eye parts
70 OC = 17 : REM Initial outer color
80 MC = 18 : REM Initial middle color
90 CC = 19 : REM Initial center color

100 FOR STEPS = 1 TO 1000 : REM Loop to keep CBS eye wandering
110 GOSUB 4000 : REM Move the eye to a new random position
120 GOSUB 2000 : REM Draw the CBS Eye with changing colors
130 GOSUB 3000 : REM Pause between moves
140 GOSUB 5000 : REM Update the color scheme for the next iteration
150 GOSUB 1000 : REM Clear the screen for the next position
160 NEXT STEPS

999 GOTO 10 : REM Loop back to the beginning for continuous run

1000 REM Clear the Screen Routine
1010 DZOP "C",16 : REM Clear screen with black
1020 DZOP "P",0,0
1030 DZOP "R",255,255
1040 RETURN

2000 REM CBS Eye Drawing Routine
2010 DZOP "C",OC : REM Set color for outer circle
2020 GOSUB 2100 : REM Draw outer ellipse (CBS outer shape)

2030 DZOP "C",MC : REM Set color for middle part
2040 GOSUB 2200 : REM Draw middle ellipse (CBS mid shape)

2050 DZOP "C",CC : REM Set color for center circle
2060 GOSUB 2300 : REM Draw center circle (CBS center)

2095 RETURN

2100 REM Draw Outer CBS Eye Ellipse (Wider Ellipse)
2110 FOR T = 0 TO (2*PI) STEP 0.1
2120 X = XC + 70 * COS(T) : Y = YC + 40 * SIN(T)
2130 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D" : REM Only plot valid coordinates
2140 NEXT T
2150 RETURN

2200 REM Draw Middle CBS Eye Ellipse (Smaller Ellipse)
2210 FOR T = 0 TO (2*PI) STEP 0.1
2220 X = XC + 50 * COS(T) : Y = YC + 25 * SIN(T)
2230 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2240 NEXT T
2250 RETURN

2300 REM Draw Center CBS Eye Circle
2310 FOR T = 0 TO (2*PI) STEP 0.1
2320 X = XC + 20 * COS(T) : Y = YC + 20 * SIN(T)
2330 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2340 NEXT T
2350 RETURN

3000 REM Pause Routine
3010 FOR PAUSE = 1 TO 300 : NEXT PAUSE : REM Short pause
3020 RETURN

4000 REM Move the CBS Eye to a new random position
4010 XC = INT(RND(1)*160) + 48 : YC = INT(RND(1)*160) + 48 : REM Random position within screen bounds
4020 RETURN

5000 REM Update the CBS Eye Color Scheme
5010 OC = OC + 1 : IF OC > 23 THEN OC = 17
5020 MC = MC + 1 : IF MC > 23 THEN MC = 17
5030 CC = CC + 1 : IF CC > 23 THEN CC = 17
5040 RETURN

9999 REM End of Program
10000 GOTO 10
