CMPSCI 383: Artificial Intelligence

Fall 2014 (archived)

A Pythonic Minimax Example

During office hours yesterday, Patrick worked with a student on alpha/beta pruning and the minimax algorithm. He wrote a short Python2 program to illustrate some of the techniques as described in the book and its examples, and asked me to post it here in case you find it helpful. The program is here: alphabeta.py

On the Edlab, the python command defaults to Python2, so you can use python alphabeta.py -h to see its help text, or, for example, python alphabeta.py -i to watch it run through the minimax algorithm on a randomly-generated tree step by step.