packages feed

hstzaar-0.4: README

HsTZAAR 
-------

HsTZAAR is a computer program to play TZAAR, a 2-player abstract strategy
game designed by Kris Burm and the last game in the GIPF project.
HsTZAAR is written in Haskell and allows for local play against a computer AI;
it also provides a good interface for programmers to implement diferent 
AI strategies.

This program was based on the htzaar implementation by Tom Hawkins.
In 2010, I started experimenting with classical AI techniques for TZAAR
and implemented them on-top of htzaar; since the later package is longer
updated, I decided to start HsTZAAR.

The main improvements so far are:

    * a better GUI using gtk2hs for widgets and cairo for high-quality 
      2D board rendering.
    * a better AI using minimax and alpha-beta prunning; it now plays at
      a challenging level (at least for a beginner like myself). 

Requirements
------------

HsTZAAR requires a resonably recent GHC compiler (version 6.10.x or newer) 
plus the gtk2hs, cairo and glade libraries. It is developed in Ubuntu 
GNU/Linux system, and should compile and run fine on other Linuxes. 
I also verified that it compiles under Mac OS X (snow leopard) and should
probabily do under Windows as well (but this was not tested).

Compilation
-----------

Using the Haskell Cabal tool (fetches the package and any dependencies, 
builds and installs):

      $ cabal install hstzaar

Alternatively, you can do the build manually from the source tarball:

$ tar xvzf hstzaar-x.y.tar.gz
$ cd hstzaar-x.y
$ runhaskell Setup.hs configure
$ runhaskell Setup.hs build
$ runhaskell Setup.hs install

AI strategies
--------------

HsTZAAR implements a few AI strategies.
  lame:    selects a random valid move
  greedy:  selects the local best move by the static evaluation function
  plyN:    simple minimaxing to N-ply
  dynN:    greedy strategy for early game, then minimaxing N-ply for later game
All of the above will select a winning move or a move to prevent the 
adversary from winning (if such moves are avaliable).

Note that higher ply values can increase memory consumption dramatically 
and do *not* necessarily play better! The default greedy strategy plays
well enough to challenge a beginner such as myself and run under 150Mb
resident space.

Usage
-----

Executing the binary starts the GUI interface for playing against an AI;
some extra options are controlled by command line arguments:

hstzaar [OPTION..] [AI AI] where OPTIONS are
  -s SEED  --seed=SEED  random number seed
  -n N     --matches=N  number of matches (for AI tournaments)
  -T       --tests      run QuickCheck tests

Examples:

1) Run a tournament between the greedy and ply2 strategies: 
   10 matches (5 random boards, each strategy plays first white
   then black, fixing the random seed for repeatebility):

   $ hstzaar -s0 -n10 greedy ply2

2) Run QuickCheck correctness tests (see source code for details on these):

   $ hstzaar --tests


Pedro Vasconcelos, 2010
pbv@dcc.fc.up.pt