Project 2: Adversarial Search
For this project, you will program an automated player for a 2-player zero-sum game of
your choice. Good choices are tic-tac-toe, checkers, chess, go, connect four, or almost
any abstract strategy game: a game with perfect information (the entire state of
the game is available to both players),
and no chance. Here's a list of more abstract strategy games.
What you need to do
First, choose a game. Try to choose a game where it is straightforward to adjust
the branching factor and/or depth of the terminal nodes of the game tree. For instance,
in tic-tac-toe, you can change the size of the board and how many X's or O's in a row you need.
Part A: Minimax
Write a player for your game that uses the (regular) minimax algorithm to play. Obviously,
this player should play optimally. Because some games have very large search trees, this
is where you can adjust the aspects of your game to make a full minimax search feasible.
Part B: Alpha-Beta Pruning plus Heuristics
Write a player for your game that uses the alpha-beta pruning version of the minimax
algorithm to play. You will need to write an evaluation function as well, because for
this part you should use a version of the game with a search tree that is too large for
regular minimax. This may be the regular version of the game (e.g., checkers, chess),
or you may need to "scale-up" your game to make it interesting (e.g., tic-tac-toe).
For this part, your player is not expected to play optimally, because your evaluation
function may make mistakes. However, you should try to write a good evaluation function
so the player plays well.
Part C: Random Player
Write a player for your game that plays randomly (just picks moves arbitrarily).
It should not do the same thing in the same situation all the time; there should actually
be some stochastic behavior.
Writeup
You will turn in your code, but also a writeup with the following:
- Describe the behavior that occurs when your minimax player (part A) plays against itself,
and against a random player (part C). For instance, does it always tie? Does the first
player always win? What "interesting" things does the minimax player do that perhaps seem
unexpected (that maybe a human wouldn't know to do)?
Turn in some output from your program that illustrates a run of the minimax algorithm.
This can be short, but it should illustrate that your code correctly implements the
algorithm. It's also OK to have this output come from a "contrived" game situation
that you invent and ask the program to solve, rather than arising spontaneously
during play. For instance, you could pick a game state very close to the end
of play, so that the search tree from that point is small.
- Re-answer the same questions from before, but with your alpha-beta player (part B) playing
against itself and against a random player (part C).
Additionally, describe how you chose to construct your evaluation function and
when/why you decided to use it (how deep you searched before stopping and using
the function).
As in Part A, turn in some output from your program illustrating the alpha-beta pruning algorithm is
working correctly.
What to turn in
Through Moodle, turn in your code, instructions on how to run your code,
and your writeup.
Grading
You will be graded on correctness of your program, the quality of your evaluation
function, and the thoroughness of your writeup.