Last active
April 4, 2023 14:24
-
-
Save timsonner/98ee661c6b0383326372aea5a7bc3317 to your computer and use it in GitHub Desktop.
QBasic. Draw random circle at random coordinate with random radius and fill color.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SCREEN 12 ' Set screen mode to 640x480, 32-bit color | |
| DO ' Infinite loop | |
| RANDOMIZE TIMER ' initialize the random number generator | |
| ' Generate random circle properties | |
| x = INT(RND * 641) ' Random x-coordinate 0 to 640 | |
| y = INT(RND * 481) ' Random y-coordinate 0 to 480 | |
| r = INT(RND * 101) ' Random radius 0 to 100 | |
| c = INT(RND * 16) ' Random color 0 to 15 | |
| ' Possible colors | |
| ' 0:black, 1:blue, 2:green, 3:cyan, 4:red, 5:magenta, 6:brown, 7:light gray, | |
| ' 8:dark gray, 9:light blue, 10:light green, 11:light cyan, 12:light red, | |
| ' 13:light magenta, 14:yellow, 15:white | |
| COLOR c, 0 ' Set Color to c, background color to black | |
| CIRCLE (x, y), r ' Draw circle with center at coordinate (x, y) with radius r | |
| PAINT (x, y), c ' Fill shape at coordinate with color c | |
| LOOP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment