Lecturer: Dr. Martin Johnson
Telephone: (443) 9662
This Assignment involves writing a program to play three dimensional noughts and crosses on a 4x4x4 board.
The board is a 4x4x4 array and the object of the game is to place four balls in a row. Shown here is a winning position for the grey balls. There are 76 possible lines.
Your program needs to read a complete board position from a data file called "board" in the current directory.Your program can then change the board position by making a move, and write the new position into the same file over the original data.
The "board" file consists of 64 characters, each one represents a place on the board. The order of the characters in the file is the same order that they would be printed to the screen, i.e. left-right then back-front then top-bottom. If the character is the character '0' then the place is empty. A '1' is an X and a '2' is a O. Assume that you are always X and your opponent is always O. A single move should take no longer than five seconds on the PCs in the lab. Programs that take longer than this may be disqualified. You may use any language you wish as long as it is available on the PCs i.e. C or PASCAL.
The H: drive of the machines in the lab contains a short program (in C) called "checkpos.c" to check for a win and to print out a board position. Use this to check that your program is working. A program called "mymove.c" is provided to allow you to play by hand and a program "swap.c" allows two programs two play each other. An empty board is provided in the file "empty_board".
This assignment is to be submitted in two parts. By the 11th September you should submit a working program that makes a move based on a simple heuristic and search strategy.
You should submit your program (source and executable) on a disk or by email. Your programs will be played against each other and marked based on their performance and also on programming style, documentation etc. By the 16th October you should submit a program that plays as well as possible (given the time limitation). These programs will play each other in a tournament and marks will be awarded solely for performance.