10 REM - Wandering Monkey Face Monkey.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 Monkey
60 REM Set initial colors for the Monkey parts
70 IC = 18 : REM Color for Monkey head
80 EC = 23 : REM Color for eyes (white)
90 NC = 17 : REM Color for nose (black)
100 FOR STEPS = 1 TO 1000 : REM Loop to keep the Monkey wandering
110 GOSUB 4000 : REM Move the Monkey to a new random position
120 GOSUB 2000 : REM Draw the Monkey face with eyes, nose, and teeth
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 Monkey Face Drawing Routine
2030 DZOP "C",IC : REM Set color for Monkey head
2040 GOSUB 2200 : REM Draw Monkey shape
2050 DZOP "C",EC : REM Set color for eyes
2060 GOSUB 2400 : REM Draw hollow eyes
2070 DZOP "C",NC : REM Set color for nose
2080 GOSUB 2500 : REM Draw nose
2090 DZOP "C",TC : REM Set color for teeth
2095 RETURN
2100 GOSUB 2600 : REM Draw teeth
2200 REM Draw Monkey Head (Custom Monkey Shape)
2210 REM Draw round top part of the Monkey (circular)
2220 FOR T = 0 TO (PI) STEP .1 : REM Upper part - rounded
2230 X = XC + 50 * COS(T) : Y = YC + 60 * SIN(T)
2240 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2250 NEXT T
2260 REM Draw narrower bottom part of the Monkey (flattened oval)
2270 FOR T = 0 TO (PI) STEP .1 : REM Lower part - narrower jaw
2280 X = XC + 30 * COS(T) : Y = YC - 30 + 30 * SIN(T) : REM Reduced horizontal radius from 40 to 30
2290 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2300 NEXT T
2310 RETURN
2400 REM Draw Hollow Eyes (Circles for Monkey Eyes)
2410 REM Left Eye
2411 FOR T = 0 TO (2*PI) STEP .1
2412 X = XC-20 + 10 * COS(T) : Y = YC+10 + 10 * SIN(T) : REM Left eye circle
2413 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2414 NEXT T
2420 REM Right Eye
2421 FOR T = 0 TO (2*PI) STEP .1
2422 X = XC+20 + 10 * COS(T) : Y = YC+10 + 10 * SIN(T) : REM Right eye circle
2423 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2424 NEXT T
2430 RETURN
2500 REM Draw Nose (Triangle for Monkey Nose)
2510 DZOP "P", XC-5, YC : DZOP "L", XC+5, YC : DZOP "L", XC, YC-10 : DZOP "L", XC-5, YC : REM Simple triangle for nose
2520 RETURN
2600 REM Draw Teeth (Vertical lines for Monkey Teeth)
2610 DZOP "P", XC-20, YC-30 : DZOP "L", XC-20, YC-40 : REM Left tooth
2620 DZOP "P", XC-10, YC-30 : DZOP "L", XC-10, YC-40 : REM Left center tooth
2630 DZOP "P", XC, YC-30 : DZOP "L", XC, YC-40 : REM Center tooth
2640 DZOP "P", XC+10, YC-30 : DZOP "L", XC+10, YC-40 : REM Right center tooth
2650 DZOP "P", XC+20, YC-30 : DZOP "L", XC+20, YC-40 : REM Right tooth
2660 RETURN
3000 REM Pause Routine
3010 FOR PAUSE = 1 TO 300 : NEXT PAUSE : REM Short pause
3020 RETURN
4000 REM Move the Monkey Face 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 Monkey Face Color Scheme
5010 IC = IC + 1 : IF IC > 23 THEN IC = 17
5040 RETURN
9999 REM End of Program
10000 GOTO 10
