ANN: Pentago AI Player Testbench 0.3.5

Pentago is an easy to learn, fun, abstract strategy board game. See http://www.pentago.se/ for more information. I bought the board game just before Christmas 2005 and soon decided to write my own AI player. The Pentago AI Player Testbench includes a game implementation and a couple of test players (slump, adam, bertil, caesar and david).

There are a couple of different ways to use the testbench. It (pentago.py) can run in singleplayer mode (sets up a game between a player and every other registered AI player), tournament mode (sets up games between all registered AI players) or in versus mode (sets up games between two AI players).

There's also a pygame script (interactive.py) included which is rather crude and should be considered a quick hack but which hopefully conveys the general idea of how the game is played.

It's easy to write your own AI player. Write a player script with one class (must be called "Player" and should have pentago.Player as it's base class). The player object must implement at least two methods: placeMarker() and rotateSquare(). placeMarker should return two integer values x and y which are in range(6) and are used to position your player's marker. rotateSquare should return a square index (in range(4)) and a direction (in [-1, 1]). The square index indicates which square should be rotated and a direction value of -1 indicates counter-clockwise rotation and 1 indicates clockwise. When you're done, place the file in the players directory and test it with, for example:
[python] pentago.py --mode singleplayer --player

A zip with the source can be found at http://www.pulp.se/johan/pentago/pentago-0.3.5.zip

Johan Lindberg

[sent to comp.lang.python.announce]