## CS 5541 Program 2 - Minimax for Games Due October 27, 200940 points

### Introduction

Minimax is a method for perfect play in certain types of games. In this project we are going to explore minimax with alpha-beta pruning, looking at a game where perfect play is not tractable, but where minimax is nevertheless useful.

In the code found at http://www.d.umn.edu/~rmaclin/cs5541/Programs/ConnectFour.zip I have defined some simple code for representing a command line connect 4 game (if you want to add a nicer interface feel free). You must implement an AI player for the game by substituting a routine to automatically play as the black player by replacing the six lines after "// Make black move" in the Main routine with a minimax routine that can use alpha-beta pruning.

### Some Implementation Details

An evaluation function - you are welcome to experiment, but you will find that it is unlikely you will be able to calculate the full minimax tree to perform perfect play. Instead you should use a method to limit the search to some reasonable amount and then have a heuristic evaluation function to determine some value for the resulting state.

Limiting your minimax function - the simplest way to limit your function is to limit how deep your search goes. To determine what is a reasonable depth I would suggest making the depth a parameter and then to try various depths to see what value you should use. Make sure to have your code measure how much time is taken for the search you do.

Alpha-beta pruning - you should make alpha beta pruning an option for your code. It is important to also report time here as you may see some reduction in time when using this option (which might make it possible to use a deeper search depth).

Your heuristic - a number of heuristics have been defined for Connect 4. Do a little research and find two heuristics that interest you. Play games with both heuristics.

### Testing

After selecting an appropriate depth to search play 5 games each against your program with each heuristic using minimax and then repeat that for minimax with alpha-beta pruning. Count the number of computers wins, losses and draws for each game plus time information. In addition, show an example run for each heuristic for minimax with alpha-beta pruning (including time information).

### What To Hand In

Turn in a commented copy of your code, a discussion of the heuristics you chose, a summary of the results you achieved playing the computer, a discussion of those results and a copy of the example runs of the game.