Connect-4 for the unexpanded VIC-20 I thought I'd share with the rest of the Commodore world a little program I just finished writing. It's a game of Connect-4, where the human player tries to beat the computer. In case you're not familiar with the rules of the game, they are as follows: Connect-4 is a two-player game in which one player is designated `X' and the other is designated `O'. Each player has a stack of chips. A 7x6 board is placed between the two players, propped up vertically. It has seven `slots' at the top of it, one slot for each column. When a game chip is dropped into one of these slots, it slides down until it either rests at the bottom of the board or on top of another chip. The two players take turns dropping a chip into a slot of their choice. The first player to connect four of his/her color in a row is the winner. This connection can be vertical, horizontal or diagonal, but it must lie in a straight line and must be connected. In this computerized version of the game, a human (`X') plays a computer opponent (`O'). At the beginning of each game you will be asked what skill level you wish the computer to play at. This is equivalent to the number of moves the computer looks ahead in the game. On a stock C64/VIC-20, skill level 4 is a good level (any less and the computer is easy to beat, any more and the computer takes too long to make a move). If you have the new 20Mhz accelerator chip from CMD, you can comfortably play a game at level 5 and enjoy a more challenging game. The first thing you'll notice about the game is that it has a very simple interface. There are no fancy graphics or sound effects. The main challenge of writing this game was to prove to myself that I could write a challenging Connect-4 AI routine that would be fast and efficient enough to be playable on an 8-bit 1Mhz machine. A secondary goal of mine was to squeeze the game into as few bytes as possible. I managed to achieve both goals, and thus I present to you a challenging Connect-4 game for the Commodore 64/VIC-20 that is a mere 1518 bytes in size. The AI algorithm used in this game is based on an algorithm I developed in LISP about four years ago. Since then I've converted the LISP code into more portable, more generic ANSI C code, and have written a few interfaces to this code (one of which is an HTML interface, playable via the World- Wide Web - see "http://www.pobox.com/~pomakis/c4/"). This C=64/VIC-20 version was written entirely in 6502 assembly language using the BUDDY assembler. Without further adue (I've rambled on long enough), here's the game. Just load and run it as you would a BASIC program. Press 'Q' or '0' at any time to abort a game or return to BASIC. Feel free to e-mail me with any comments you might have on the game. .--------------------+--------------------------------------------. | Keith Pomakis | Don't take life too seriously. | | pomakis@pobox.com | After all, you'll never make it out alive. | +--------------------+--------------------------------------------+ | WWW home page: "http://www.pobox.com/~pomakis/" | `-----------------------------------------------------------------'