Upthrust - AI Game Project for 1998

For this course, your project is to write an AI program that can play the game Upthrust. Your program will have up to 15 seconds to make its move. At the end of class there will be a tournament among the AI programs, and the team with the winning programs wins extra credit points.

If you wish to purchase the game, one place you may do so is from Madison Avenue Games (now defunct!). However, you do not need to purchase the game, as the rules will be described here (and you can easily make your own) along with a computer version that you can play:

upthrust.tar.gz - Gzip, tar'd source code in C that implements the game and rules (C source code).

Game Manager

The game manager is a program designed to act as an interface between two AI programs. Rather than manually input moves to the AI programs, I ask that your program conforms to the I/O specs of the game manager. This allows programs to directly communicate and greatly speeds up the time it takes to run the tournament. View the README file for more information.

manager.tar.gz - Gzip, tar'd source code in C for a game manager that will automate gameplay between AI programs. The latest modification to this code on 11/13/98 prints out the move if an invalid move is received.

My upthrust code: aicode.tar.gz is my AI playing program if you want to take a look and see how I implemented it. It is designed to run with the game manager.

Game Rules

The game consists of a playing board with four columns and 11 rows that form a grid. The top six rows of the grid are scoring rows. Pieces are played in the spaces within the grid. There are four pieces of four colors (Green, Red, Blue, Yellow) that are initially placed on the board in prespecified locations.

In the two player game, each player each player initially picks two random colors and one player is selected to move first. Players alternate turns, and on each turn that player may move any piece that is one of the selected colors.

The initial state of the board is shown below.

     60  . . . .
     40  . . . .
     30  . . . .
     20  . . . .
     10  . . . .
         . . . .
         . . . .
         G R B Y
         R B Y G
         B Y G R
         Y G R B

Rules of Play

On a turn, a player moves one of his/her pieces straight up the board -- always staying in its column. The movement is governed by the following rules:

  1. A piece must move exactly as many spaces up as there are pieces in the horizontal row from which it departs. Thus, if there are two pieces in a row, either piece may move up exactly two spaces. After one piece is moved, the other may only move up one space since it has become the solitary piece in the row.
  2. Only one piece may occupy a space. Pieces may jump over other pieces, as long as they land on empty spaces.
  3. The most advanced piece of a color may not make a single space move. Therefore, a piece that is alone in a row cannot move if the other three pieces of the same color are below it on the board.
  4. On any of the bottom six rows of the board (the non-scoring rows) two pieces of the same color may NEVER be in the same row at the same time. This restriction does not apply to the five scoring rows.
  5. If a player is not able to move any of his/her pieces, that player loses that turn. But at later turns, moves may become available.
  6. Even when a piece has reached the scoring zone, it can continue to move up the board with regard to rules 1-3.

The game ends when:

  1. No player is able to make a legal move
  2. Only two pieces remain outside the scoring zone
The winner is the player whose pieces total the highest.