The complete program is given below.
Here is the completed program. You may wish to run it a few times and see how good your crowd estimating ability is.
' LET NUMBER = INT( 30000*RND ) ' pick a random number 0 to 29,999 ' SCREEN 12 FOR DOT = 1 to NUMBER LET X = INT( 640*RND ) ' pick a random column 0 to 639 LET Y = INT( 480*RND ) ' pick a random row 0 to 479 PSET( X, Y) ' draw the random point NEXT DOT ' PRINT "How many spots are there" READ GUESS ' LET ERROR = NUMBER - GUESS PRINT "There are", NUMBER, "spots. You missed by", ERROR, "spots." ' END
There are many other graphics progams you could write that use
random numbers and FOR
loops.
For example, your program could draw circles or squares placed at
random locations.
Or the program
could randomly change the color of the graphics pen
before drawing each figure.
Remember that there are 16 colors for graphics screen 12,
numbered from 0 to 15.
You can change the pen color (the color the system uses to
draw with) by using one of these integers with the COLOR
statement:
COLOR ColorNumber
Here is a statement that (when completed) will randomly change ColorNumber to some integer 0 through 15.
COLOR INT( ______ * ______ )
Fill in the blanks so that it works correctly.