Classic Computer Magazine Archive ANTIC VOL. 5, NO. 10 / FEBRUARY 1987

Game of the Month


By Jeremy Birn

Quatro is a colorful computerzied version of Blind Man's Morris, the traditional strategy game where you beat an opponent by lining up four pieces in any direction. Compete against your Atari or a human player: This short BASIC program works on all 8-bit Atari computers of any memory size, with disk or cassette.

Quatro is a slick computer adaptation of Blind Man's Morris or "Connect-4," the popular strategy game where you compete to line up four squares of your color--horizontally, vertically or diagonally. You can challenge either your Atari (a truly formidable player) or a human opponent.

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


After you SAVE a corrected, complete version of Quatro, you need to follow the special instructions below:

These special instructions are necessary because Quatro is one of those BASIC programs that will not RUN properly if the lines weren't typed perfectly and in the proper order. But, the following sequence of LIST, NEW," ENTER and SAVE commands prevents this problem. (For a more detailed explanation of the phenomenon, read about Variable Name Tables in Your Atari Computer by Lon Poole, $17.95 Osborne/McCraw-Hill, Beveley, CA. --ANTIC ED)

1. LIST the program to disk or cassette. Be sure the TYPO II program has been removed before you do this.
2. Type NEW.
3. ENTER the program back into the computer.
4. SAVE the program to disk or cassette with the SAVE command.

When you RUN Quatro, first you'll see the title displayed while six different-colored horizontal "tracks" are drawn on the screen. (Don't worry, Quatro works with monochrome or black-and-white screens too.)


Black and White, the text lines at the bottom of the screen, let you choose the color used by each player, and whether you or your Atari control each color. Move the joystick up and down to switch between Black (player 1) and White (player 2).

Now, move the joystick from side to side to choose who controls each player. You may pick from Stick 1, Stick 2, the Computer, or Random moves.

For example, to play a game against a friend and use two joysticks, one line should be Stick 1 and the other should be Stick 2. To play against yourself (or a second person) using only one joystick, set both Black and White to Stick 1. You can also play against the computer, or have your Atari play against itself.

When you set Black or White to Computer mode, Quatro will use a challenging "artificial intelligence" routine to select the best possible move against you. Quatro bases its choice on the current state of the game board, the relative advantages of each legal move, and any negative implications such a move might present. Pit your Atari against itself for an exciting demonstration of these routines. Just set both Black and White lines to Computer.

Quatro also has a random mode, in which the computer randomly chooses its move from all legal moves. The advantage here is that your Atari is easy for you to beat in this mode.


After you establish who's playing who, press the joystick trigger or the [START] key to begin playing. The bottom of the screen shows the move number and whose turn it is.

When the game calls for Stick 1 or Stick 2, move the appropriate joystick up or down to control a flashing yellow stripe. Place the stripe in the center of a track and press the joystick trigger. A square in your color will appear at the far right end of that track.

Succeeding squares in that track will always appear in the right most empty position of the track, until the track is filled. If all six tracks are filled without anyone forming a row of four, the game is tied. You can abort a game anytime by holding down the [SELECT] key.


After your Atari randomly choses a first move, it will take a few seconds to look at each legal move. One way to beat the computer is to set up two possible winning tracks. The computer can block only one of them, so you can win in the other. Another way is to set up a track where you could win, but if the computer blocks you, you could also win in the space made available to the left of the computer's block.

No single pattern always works. To learn more about how your Atari plays, watch it compete against itself in various combinations of Computer and Random modes. You can learn a lot about the patterns of the game itself by watching Random vs. Random.


Quatro uses a modified Graphics 7 screen. Instead of changing the color of the whole background at once, as with a SETCOLOR command, the background color of each text or graphics stripe is set independently through a modified display list.

Throughout the program, a Display List Interrupt (DLI) updates the color of each stripe, one at a time. The DLI gets the appropriate color values from a lookup table which begins at the memory location contained in the Variable SET. By POKEing different values into this table, the program can draw multicolored stripes in the background and highlight a text stripe to show whose turn it is.

The DLI routines occupy lines 30000 to 31000. Advanced programmers may wish to use this stand-alone subroutine in their other programs-- which would call the routine with a GOSUB 30000 statement.

This DLI routine occupies the low part of Page Six and is compatible with most graphics modes. It will also work with many modified display lists!

You can now independently set the color of each stripe by using the command POKE SET+Y,COLOR. In this command, Y is the row number (the top row is row zero), and COLOR is the appropriate POKE value of the color to be used.

By default, these colors will be put into color registers two and four. This colors the background of both graphics and text. To use other color registers, POKE CA and CB with the appropriate register number, printed below. (See line 70 for an example of this technique.) If you only want to control one register, set both CA and CB to the same register number.

The codes for the registers are:

18-21 Player/Missile Colors
22 Register 0 (Default Yellow)
23 Register 1 (Default Green)
24 Register 2 (Default Blue)
25 Register 3 (Default Red)
26 Register 4 (Default Black)

This routine is shorter, easier to use and more flexible than a "preset" DLI in most situations. In fact, to achieve the same effects, you would usually need a chain of several DLIs.

Jeremy Birn is a student from Delmar, New York: and Quatro is his first publication in Antic.

Listing:QUATRO.BAS Download