Due Tuesday, May 7 at 11:59 PM via Blackboard. Please submit your code (in .py or .cpp format) and write-up separately. Late assignments penalized 10% per day.

Relevant Reading

Chapter 5, Sections 5.1 to 5.3.

Assignment

You can work in pairs on this assignment. Each student must turn in their own, individual homework write-up along with the code.

Starter code

We've provided starter code that plays a basic version of the game. The starter code, and the code you will turn in, matches one computer player against a human (who enters moves interactively).

C++ Starter Code

The C++ starter code includes the following key functions:

Python Starter Code

The Python starter code includes the same functions as documented for the C++ code above, with a few minor differences (e.g., blanks are indicated with 'N' instead of 0, and the get square function is zero-indexed). Note, this code runs in Python 3.x; if you use 2.x, you may need to make small alterations to the code to get it to function.

What to turn in

  1. Implement a tic-tac-toe program that uses Minimax and Alpha-Beta Pruning. See the implementation guidelines below. Include the following:
    1. (1 point) Your code, including a readme that says which compiler you used and how to run your game.
    2. (1 point) A output trace of your program in action, with the computer playing as the O player (moving second) in one game and the X player (moving first) in the other (each team member must do his or her own runs).
    3. (1 point) Describe who within your group performed which piece of the design/programming effort.
  2. Answer the following questions regarding your program. These answers should be succinct (two or three sentences each), but specific enough that we could almost re-implement your solution based on the answers.
    1. (1 points) Which part of your code generates the next ply, and how does it work?
    2. (1 points) What is your evaluation function, and why is it good?
  3. (1 point) How will you have to alter your code in order to play Othello? In about one paragraph, describe the changes you'll need to make and where these will occur in the code. Assume we will provide starter code that implements the basic rules of Othello, as we did for Tic Tac Toe.