Classic Computer Magazine Archive ANTIC VOL. 7, NO. 5 / SEPTEMBER 1988



Color Vision Booster

Tricky game improves color perception

Color VisionTest-and improve-your color perception with this deceptively simple matching game. The BASIC program works on all 8-bit Atari computers of any memory size, with disk or cassette. Of course, a reasonably accurate color video display is required.

It is an astonishing fact of life that within the relatively small bandwidth of visible light-400 to 700 nanometers-most human beings can distinguish about three and a half million different colors. If we make a comparison to sound energy, we discover that visible light covers less than an "octave," and yet our eyes have a most amazing sensitivity to the possible combinations of colored light.

The price we pay for this sensitivity is that our perception of any given color is relative. The same color will appear different, depending upon factors such as the colors surrounding it and the kind of light illuminating it. Color Vision Tester is an educational game based upon this relativity of color perception.

Color Vision Tester checks your color sense with a display of three different-colored nested rectangular boxes on a background of a fourth color. Use the joystick to change the color of each box to match the background. Start on the center box and work outward. When you're done, the video screen should be one even, unbroken, flat field of color.

It's not as easy as it sounds. I tested the game on college level painting students in a course on color perception and the success rate was about 50%-but practice should help.


Type in Listing 1, COLORVIS.BAS, check it with TYPO II and SAVE a copy before you RUN it.

Following a title screen, press any key to start the game. The Atari fills the screen with four randomly generated colors.

Try to match the innermost rectangle to the background by manipulating the joystick. Moving it left or right changes the hue. Moving it up or down changes the Luminance. When you think you've made a match, press the joystick button. This will freeze the color in that box and move you to the surrounding one.

Repeat the process and press the joystick button again when you think you've made a match. Match up the outermost rectangle and press the joystick button again. If you "win," several colorful, congratulatory screens appear.

Don't be discouraged if you "lose" a lot when you first take on the Color Vision Tester. You'll improve rapidly I put the words win and lose in quotes because the game really isn't about winning or losing-it's about sharpening your color perception.

Color Vision Tester is based on the phenomenon of simultaneous contrast. The tendency of the human eye to see complementary colors, even if they're not there. A small rectangle of any color on a field of red will assume a greenish cast because the eye wants to see green. On a blue field, the color will look more orange than it really is.

Also, a given color will look brighter on a dark background or darker on a light background. Type in Listing 2, COLORV2.BAS, for a demonstration of this phenomenon. Check it with TYPO II and SAVE a copy before you RUN it.


If Color Vision Tester was set up to work in reverse- starting with the outer rectangle and working inward, only persons with some form of color blindness would have any trouble succeeding. But trying to match two colors separated by one or two intervening colors is not so easy.

Line 99 dimensions a string for the color name. Lines 100 to 500 divide the program into five discrete steps. Line 599 clears the screen if the player chooses not to play again. It returns the user to BASIC with Color Vision Test still in memory.

Lines 1000-1999 set up and display the title screen in Graphics 2. The delay loop determines how long the screen is displayed and can be modified to your taste.

Lines 3000-3990 draw the game screen, using a draw subroutine at line 6000. Lines 3010-3015 turn off the screen display while the computer is configuring the screen memory. Lines 3020-3180 generate random even numbers for the four colors, compare them to each other to ensure that four different colors are displayed, and POKE those numbers into the appropriate color registers. Lines 3200-3210 change the variables for the boxes in order to draw different sizes. Line 3380 sets the background color and turns on the screen display.

In lines 4000-4999 the variable N is set to the three boxes in order from smallest to largest. The program then branches to the subroutine at 7000 for the joystick input, which changes the values in the color registers.

Lines 5000-5999 display the outcome screens. The three color variables are set to their actual values and then compared to each other and the background. If the values are not equal, the program branches to line 5500 to display the "losing" screen. Otherwise it branches to the subroutine at 8000 to calculate the color number (and thus the name) and luminance value.

If all four color registers are equal, a series of congratulatory screens is displayed, The delay loops at 5181, 5210 and 5301 can be changed. Lines 5325-5499 OPEN the keyboard for a yes/no response from the user, CLOSE the keyboard and branch to the end of the program or the beginning of another game without the title screen or instructions. Lines 5500-5999 display the color names and luminance values for all four color registers, ask if another game is desired and branch accordingly.

Lines 6000-6999 do the actual drawing of the the four rectangles according to the values set in the subroutine at 3000.

Lines 7000-7999 change the value in a color register based upon joystick input, and keep those values between 0 and 255. This is an infinite loop unless the joystick button is pressed. Adjust the delay loop at 7060-7070 to suit your joystick. Line 7090 checks for the joystick button and the delay loop at line 7997 allows for switch bounce in the button.

Lines 8000-8999 calculate the Atari color number, name and luminance.

Erik Timmerman, a faculty member at the Rochester Institute of Technology in Rochester New York, teaches flimmaking and computer animation.

Listing 1: COLORVIS.BAS Download

Listing 2: COLORV2.BAS Download