Saturday, July 18, 2009

Getting started with IronPython – Part 4: MiniMax algorithm

Dror Helper continues his series on getting started with IronPython programming. He has been creating an example game and after his last entry on unit testing he moves onto adding some simple AI logic:
As part of my quest to learn how to program in Python I’ve decided to implement a simple Minimax algorithm.

The algorithm is simple and relies on a elementary principle – each turn you will choose the best move and your opponent will choose the worst move for you. By building a search tree with a limited depth we can then choose each time either the maximum result possible or the minimum result according to the player’s turn.

You can read more about Minimax algorithm in Wikipedia – or continue reading and learn it from my implementation.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.