Color Vision Booster (ColorVision)
- Type
- Education
- Category
- Colour-perception matching game
- Author
- Erik Timmerman
- Published in
- Antic, September 1988 (Vol. 7, No. 5)
- Year
- 1988
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, Atari BASIC, joystick in port 1, a colour display
About the program
Erik Timmerman taught filmmaking and computer animation at the Rochester Institute of Technology. In the September 1988 Antic he published a small game about how relative colour perception is. (The magazine called it Color Vision Booster; the program calls itself ColorVision, and the article also says Color Vision Tester.) The screen shows three nested rectangles, each a different random colour, on a background of a fourth. Using only the joystick, you have to change each rectangle until it matches the background exactly, starting with the innermost one. When you've finished, the screen should be a single flat field of colour.
It sounds easy. Timmerman tried it on college painting students taking a course in colour perception, and about half of them succeeded. The trick is simultaneous contrast: the eye pushes a colour towards the complement of whatever surrounds it, so a patch on red looks greener than it is, and the same grey looks lighter on black than on white. Because you have to match the centre box to a background two rectangles away, every intervening colour bends your judgement. Done the other way round, from the outside in, Timmerman said only someone with some form of colour blindness would have trouble.
What you need
Any Atari 8-bit with Atari BASIC, a joystick and a reasonably accurate colour display. On a modern screen or in an emulator, the palette setting changes how hard it is.
Typing it in
Both listings are plain BASIC. The only special characters are inverse letters in the title and messages ({inv}…{/inv}, typed with the Atari key on) and {CLEAR} in lines 5185, 5230 and 5310 (ESC, then SHIFT-CLEAR). Listing 2, COLORV2.BAS, is a separate ten-line demonstration.
How to play
RUN Listing 1. After the title screen (a delay loop in this version; the article mentions pressing a key), the rectangles appear.
- Left/right steps the hue: 16 hues.
- Up/down changes the luminance in steps of 2 (eight levels).
- Press the button when the box seems to match. It's frozen and you move on to the next box out.
When the outer box is done, the program compares all four colour registers. A perfect match gets congratulation screens showing the colour's name and luminance. Otherwise a report lists the hue name and luminance of each rectangle and the background, so you can see how far off you were. Answer Y to play again.
Then RUN Listing 2. It shows two identical dark purple squares, one on black and one on white. Most people see two different colours.
How it works
- Colour registers, not pixels. The rectangles are drawn once in GRAPHICS 23 (GRAPHICS 7 without the text window) with
COLOR 1,2and3, and the background is register 712. Changing a box's colour is just aPOKEto 708, 709 or 710 (line 7080), so it's instant. - The colour byte. An Atari colour value is hue × 16 + luminance. Moving the stick sideways adds or subtracts 16, and up/down adds or subtracts 2, wrapping round between 0 and 255 (lines 7000–7050). Lines 8000–8190 split the value back into hue and luminance and name the hue, from Gray, Gold and Orange through to "Orange II".
- Random start. Lines 3020–3110 pick four different non-zero even values, the only ones that matter, since the lowest bit of a colour register is ignored.
- Line 3015 blanks the display (
POKE 559,0) while the boxes are drawn, and each column clicks through the speaker as it's plotted (line 6020).
Variations to try
- Swap the order of lines 4000 and 4060 so you match the outer box first, and see how much easier it is. Timmerman's point was that the order makes all the difference.
- Change the step in lines 7010/7040 to 1 and watch the luminance stay the same on alternate steps: the low bit does nothing.
Listing
Listing 1, COLORVIS.BAS:
10 REM COLORVISION
20 REM BY ERIK TIMMERMAN
30 REM (c)1988, ANTIC PUBLISHING
99 DIM N$(12)
100 GOSUB 1000:REM TITLE PAGE
300 GOSUB 3000:REM INITIALIZE
400 GOSUB 4000:REM PLAY GAME
500 GOSUB 5000:REM RESULTS
550 IF EXIT=0 THEN 300
599 GRAPHICS 0
600 END
1000 GRAPHICS 2
1010 POKE 710,0
1020 POSITION 4,5
1030 ? #6;"Co{inv}l{/inv}O{inv}r{/inv}vI{inv}s{/inv}ioN"
1040 POKE 755,0
1050 ? " by Erik Timmerman"
1060 ? " (c)1988, Antic Publishing"
1070 FOR DELAY=1 TO 1700
1080 NEXT DELAY
1999 RETURN
3000 GRAPHICS 23
3010 SCR=PEEK(559):EXIT=-1
3015 POKE 559,0:TRAP 3390
3020 W=2*INT(RND(2)*127):IF W=0 THEN 3020
3040 X=2*INT(RND(3)*127):IF X=0 THEN 3040
3060 IF X=W THEN GOTO 3040
3070 Y=2*INT(RND(4)*127):IF Y=0 THEN 3070
3090 IF Y=W OR Y=X THEN 3070
3110 Z=2*INT(RND(5)*127):IF Z=0 OR Z=W OR Z=X OR Z=Y THEN 3110
3160 POKE 708,X:POKE 709,Y:POKE 710,Z
3190 REM DRAW RECTANGLES
3200 FOR A=1 TO 3:B=20*A:C=160-20*A:D=95-10*A:E=10*A
3210 GOSUB 6000:NEXT A
3380 POKE 712,W:POKE 559,SCR
3390 RETURN
4000 N=Z:COLREG=710:GOSUB 7000
4030 N=Y:COLREG=709:GOSUB 7000
4060 N=X:COLREG=708:GOSUB 7000
4999 RETURN
5000 X=PEEK(708):Y=PEEK(709)
5020 Z=PEEK(710)
5040 IF X<>Y THEN 5500
5050 IF X<>Z THEN 5500
5060 IF X<>W THEN 5500
5070 IF Y<>Z THEN 5500
5080 IF Y<>W THEN 5500
5090 IF Z<>W THEN 5500
5110 A=W
5140 GOSUB 8000
5150 GRAPHICS 18
5170 POSITION 2,5
5180 ? #6;"C{inv}On{/inv}gR{inv}aT{/inv}uLa{inv}tI{/inv}OnS{inv}!{/inv}"
5181 FOR DELAY=0 TO 400:NEXT DELAY
5185 ? #6;"{CLEAR}"
5190 POSITION 6,5
5200 ? #6;"{inv}y{/inv}oU {inv}W{/inv}i{inv}N{/inv}!"
5210 FOR DELAY=0 TO 400:NEXT DELAY
5230 ? #6;"{CLEAR}":POSITION 7,3
5260 ? #6;"CoL{inv}Or{/inv}:"
5262 LET POS=LEN(N$)
5265 POSITION INT((20-POS)/2),4
5266 ? #6;N$:POSITION 5,6
5280 ? #6;"lU{inv}mI{/inv}nA{inv}NCe:{/inv}"
5290 POSITION 9,7:? #6;LUM
5301 FOR DELAY=0 TO 500:NEXT DELAY
5310 ? #6;"{CLEAR}":POSITION 2,5
5320 ? #6;"p{inv}lAy{/inv} AgA{inv}In?{/inv} ({inv}y{/inv}/N{inv}){/inv}"
5325 CLOSE #2:OPEN #2,4,0,"K:"
5330 GET #2,ANS:CLOSE #2
5350 IF ANS=89 THEN EXIT=0
5499 RETURN
5500 GRAPHICS 0:POKE 710,194
5510 POKE 709,206:POKE 755,0
5530 POSITION 10,1
5540 ? "HOW WELL YOU DID":?
5560 ? "Small Rectangle:.....Luminance:":A=Z
5590 GOSUB 8000
5610 ? N$;:POSITION 33,4:? LUM
5630 ? :? :? "Middle Rectangle: ...Luminance:"
5640 A=Y
5650 GOSUB 8000
5660 ? N$;:POSITION 33,8:? LUM
5670 ? :?
5680 ? :? :? "Large Rectangle: Luminance:"
5690 A=X
5700 GOSUB 8000
5710 ? N$;:POSITION 33,12:? LUM:? :?
5720 ? "Background: Luminance:"
5730 A=W
5740 GOSUB 8000
5750 ? N$;:POSITION 33,16:? LUM
5770 ? :? :? :? "Do you want to play again? (Y/N)"
5780 CLOSE #2:OPEN #2,4,0,"K:":GET #2,ANS:CLOSE #2
5810 IF ANS=89 THEN EXIT=0
5999 RETURN
6000 COLOR A:FOR LOOP=B TO C
6010 PLOT LOOP,E:DRAWTO LOOP,D
6020 SOUND 0,LOOP,14,14
6030 NEXT LOOP:SOUND 0,0,0,0:RETURN
7000 IF STICK(0)=11 THEN N=N-16
7010 IF STICK(0)=13 THEN N=N-2
7020 IF N<0 THEN N=N+256
7030 IF STICK(0)=7 THEN N=N+16
7040 IF STICK(0)=14 THEN N=N+2
7050 IF N>255 THEN N=N-256
7060 FOR DELAY=0 TO 20
7070 NEXT DELAY:REM SLOW-DOWN STICK
7080 POKE COLREG,N
7090 IF STRIG(0)=0 THEN 7997
7100 GOTO 7000
7997 FOR DELAY=0 TO 100:NEXT DELAY
7999 RETURN
8000 COL=INT(A/16)
8010 LUM=A-(COL*16)
8020 IF COL=0 THEN N$="Gray"
8030 IF COL=1 THEN N$="Gold"
8040 IF COL=2 THEN N$="Orange"
8050 IF COL=3 THEN N$="Red"
8060 IF COL=4 THEN N$="Pink"
8070 IF COL=5 THEN N$="Violet"
8100 IF COL=6 THEN N$="Blue-Purple"
8110 IF COL=7 THEN N$="Blue"
8120 IF COL=8 THEN N$="Light Blue"
8130 IF COL=9 THEN N$="Blue-Green"
8140 IF COL=10 THEN N$="Aqua"
8150 IF COL=11 THEN N$="Green-Blue"
8160 IF COL=12 THEN N$="Green"
8170 IF COL=13 THEN N$="Yellow-Green"
8180 IF COL=14 THEN N$="Orange-Green"
8190 IF COL=15 THEN N$="Orange II"
8999 RETURN
Listing 2, COLORV2.BAS (simultaneous-contrast demo; press BREAK to stop):
2 REM COLORVISION, LISTING 2
4 REM BY ERIK TIMMERMAN
6 REM (c)1988, ANTIC PUBLISHING
10 GRAPHICS 23
20 POKE 708,14:POKE 709,64:COLOR 1
30 FOR X=80 TO 159
40 PLOT X,0:DRAWTO X,95:NEXT X
50 COLOR 2
60 FOR Y=30 TO 50:GOSUB 1000:NEXT Y
70 FOR Y=110 TO 130:GOSUB 1000
80 NEXT Y
90 GOTO 90
1000 PLOT Y,40:DRAWTO Y,60:RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: COLORVIS.BAS, COLORV2.BAS.
Credits
- Program listing: Color Vision Booster (ColorVision) — program listing (Antic, September 1988 (Vol. 7, No. 5)) — Erik Timmerman
- Picture: A new puzzle: make the blue, tan and black boxes all match the yellow-green background, starting from the centre. — Erik Timmerman (program); screenshot by the site
- ANTIC Vol. 7 No. 5 (September 1988) — Color Vision Booster, by Erik Timmerman — Erik Timmerman, 1988
- Antic Software Archive — September 1988 - Vol. 7 No. 5 disk: COLORVIS.BAS, COLORV2.BAS — AtariMagazines.com (Kevin Savetz), 1988
