Bonus

Due:
11:00pm, Friday December 6, 2024

Description

Write a program based on the Minimax algorithm that implements an AI player for the game of Teeko. The game rules can be found on the Wikipedia page for Teeko

Here is an image of a Teeko board:

Teeko board

Image source

The program must read a string representing a game state from standard input and output a valid move on standard output; the program must flush the buffer after writing to standard output. The program should terminate when an end-of-file is read from standard input. Additionally, the program must be executable.

A game state string has the following form:

R 3 8 13 24 2 4 5 10

which is a character followed by eight integers separated by spaces and ending in a new line. The first character is represents the current player and is ether ‘B’ for black or ‘R’ for red. The first four integers are the positions of the black pieces and the last four integers are the positions of the read pieces. During the drop phase, unplaced positions are represented as zeros. For example, the initial state of the game is:

B 0 0 0 0 0 0 0 0 

A move is represented as two integers separated by spaces and ending in a new line where the first integer corresponds to the current piece position and the second integer corresponds to the moved position. For example, to move a piece from 13 to 8, the move is:

13 8

During the drop phase, the current piece position is represented as a zero. For example, to put a piece on the position 9 during the drop phase, the move is:

0 9

There are two files in the starter code: teeko-engine.py and random-player.py. The teeko-engine.py program takes two command line arguments which correspond to programs for the black player and red player respectively. To play a game with two players that make random moves, first make the programs executable:

chmod u+x teeko-engine.py
chmod u+x random-player.py

Then run the teeko-engine.py program like this:

./teeko-engine.py ./random-player.py ./random-player.py

The game states are written to a file named teeko.log which might be useful for debugging purposes.

Getting the Assignment

The starter code for the assignment is on the Linux server at the path:

/export/home/public/schwesin/cpsc447/teeko

Turning in the Assignment

To submit your assignment, create a zip file named bonus.zip of a DIRECTORY named bonus containing the following files:

  1. player.x – the file extension should be appropriate for your chosen language
  2. README

The README file should be a plain ASCII text file (not a Word file, not an RTF file, not an HTML file) describing your design decisions. This should also detail your choice of evaluation function. One or two English paragraphs should suffice. Spelling, grammar, capitalization and punctuation all count.

Then submit that file to the appropriate folder on D2L.

Grading Criteria

If you can create an agent that consistently beats the semi-random player, then you will receive a 10% bonus to your final course grade.