To understand this code you will want to read the following: "Machine Learning, Game Play and Go", David Stoutamire, Tech. Report TR 91-128, Center for Automation and Intelligent Systems Research, Case Western Reserve University, Cleveland, Ohio 44106. Abstract: The game of go is an ideal problem domain for exploring machine learning: it is easy to define and there are many human experts, yet existing programs have failed to emulate their level of play to date. Existing literature on go playing programs and applications of machine learning to games are surveyed. An error function based on a database of master games is defined which is used to formulate the learning of go as an optimization problem. A classification technique called {\em pattern preference} is presented which is able to automatically derive patterns representative of good moves; a hashing technique allows pattern preference to run efficiently on conventional hardware with graceful degradation as memory size decreases. This is more or less a subset of my thesis: "Machine Learning Applied to Go", MS thesis, David Stoutamire, Case Western Reserve University, 1991. Postscript for the report is available from caisr2.caisr.cwru.edu [129.22.24.22] as pub/iku/report.ps.Z, in compressed form. This is 90 pages of text. A photocopy can also be obtained by writing to the center and asking for report TR 91-128. This code requires g++ and libg++, available from prep.ai.mit.edu. It compiles successfully under 1.37 on Ultrix 2.2 on and SunOS 4.0.3. If your g++ and libg++ works, this should too. Be aware that the definition of "allgames" in line 10 of iku.h will need to change if you are running in a different directory and don't want to have to specify the games on the command line. The RandomInteger include file on line 25 of Opponent.cc changes in 1.39 to RndInt, I believe. I had it running under a crippled g++ under IRIX, for which there are some scattered #ifdef's. Under 1.37 you may get a lot of bogus "warning: declaration of `$t' shadows a parameter" messages, ignore them. 1.39 had problems with bad handling of #pragmas in the genclass-created code, so watch out; you may have to take them out, if you don't have a release that fixes this bug. A number of sample games in COSMOS format are included in the directory "games". Other games in COSMOS or Ishi format can be placed in additional subdirectories - the default definition of "allgames" is "games/*/*", so it will find anything present. For example, you can copy Go World On Disk games to subdirectories here. The games here are all taken from the net, and assumed to be PD. This code is being made available in the spirit of good science and reproducible results (something rare in computer go). I can answer questions about it, but I won't be supporting it, unless there is a lot of interest. If you are just interested in the generic go support classes, check out the file util.cc and the definitions in iku.h. Liberties and group info are updated incrementally, so it is relatively fast (although the use of sets might slow things up a lot if you want it for something backtrack-intensive such as alpha-beta). ------------------------------------------------------------------------ Usage (in a sort-of BNF form): ::= iku ... ::= play // file to record game | study | abort // turn on abortion on fatal error | help // show help file | evalfile -evalfile- // record evaluations in COSMOS form | postscriptdir -dir- // generate printable postscript of all | nolearn // turn off studying and just generate // evaluations (and report error) ::= nofile | -filename- // use "nofile" to not use recording // options (such as during "play") // "allgames" is defined in iku.h, and forever just keeps iterating ::= "-files-" | | ::= | curses | random | | | greedy ::= meta -num- ... ::= ::= -hashsize- ::= nxn -radius- | diamond -min- -max- -must-see- -libscutoff- | group -radius- --------------------------------------------------------------------- Examples: iku study hash nxn 2 2000003 nofile allgames creates an opponent consisting of a hash table of 2000003 entries, which records weights associated with patterns extracted on a square 5x5 region surrounding each evaluated move. iku study hash diamond 2 5 2 0 2000003 checkpoint allgames creates a hash table opponent as above but using a diamond shaped window of minimum radius 2 and maximum radius 5, stopping expansion after seeing two stones. Checkpointing to the file "checkpoint" occurs after each studied game. If the file did not previously exist, a new opponent (all zero entries) will be created. If the file already exists, it will be loaded. iku study map diamond 2 5 2 0 nofile allgames Same as above but using a full map to store patterns instead of the hash table. "nofile" specifies no checkpoint file. iku play curses hash diamond 2 5 2 0 2000003 checkpoint record allows the user to play the opponent saved in the file "checkpoint". The game will be stored in the file "record" in COSMOS format. iku play curses meta 2 random hash diamond 2 5 2 0 2000003 checkpoint record same as above, but with a slight random component added to randomize move selection. A meta opponent sums the evals of multiple other opponents.