GNU Go Documentation
4.5.1 Files in `engine/'
In `engine/' there are the following files:
- `aftermath.c'
Contains algorithms which may be called at the end of the game to generate
moves that will generate moves to settle the position, if necessary playing
out a position to determine exactly the status of every group on the board,
which GNU Go can get wrong, particularly if there is a seki. This module is
the basis for the most accurate scoring algorithm available in GNU Go.
- `board.c'
This file contains code for the maintenance of the board. For example
it contains the important function trymove() which tries a move
on the board, and popgo() which removes it by popping the move
stack. At the same time vital information such as the number of
liberties for each string and their location is updated incrementally.
- `clock.c'
Clock code, including code allowing GNU Go to automatically
adjust its level in order to avoid losing on time in tournaments.
- `dragon.c'
This contains make_dragons(). This function is executed before
the move-generating modules shapes() semeai() and the
other move generators but after make_worms. It tries to connect
worms into dragons and collect important information about them, such as
how many liberties each has, whether (in GNU Go's opinion) the dragon
can be captured, if it lives, etc.
- `fuseki.c'
Generates fuseki (opening) moves from a database.
- `filllib.c'
Code to force filling of dame (backfilling if necessary)
at the end of the game.
- `genmove.c'
This file contains genmove() and its supporting
routines, particularly examine_position().
- `globals.c'
This contains the principal global variables used by GNU Go.
- `gnugo.h'
This file contains declarations forming the public interface to
the engine.
- `hash.c' and `cache.c'
Hashing code implementing Zobrist hashing. (see section 14.2 Hashing of Positions) The code in
`hash.c' provides a way to hash board positions into compact descriptions
which can be efficiently compared. The code in `cache.c' implements a
kind of database for storing reading results, so they can be quickly
retrieved. The caching code uses the board hashes as keys to the database.
They are split since these functionalities are sufficiently demarked that
either file could be reimplemented without affecting the other one. Note also
that matchpat() uses the hashing code without also using the caching
code.
- `hash.h' and `cache.h'
Header files for `hash.c' and `cache.c'.
- `influence.c' and `influence.h'.
This code determines which regions of the board are under the
influence of either player.
(see section 16. Influence Function)
- `liberty.h'
Header file for the engine. The name "liberty" connotes
freedom (see section A. Copying).
- `life.c'
The code in this file contains an alternative approach to
life and death based on reading instead of the static approach
in `optics.c'. This code is experimental. It is reasonably
accurate but too slow. It is activated when gnugo is invoked
with the `--life' option.
- `matchpat.c'
This file contains the pattern matcher matchpat(), which looks for
patterns at a particular board location. The actual patterns are in
the `patterns/' directory. The function matchpat() is
called by every module which does pattern matching, notably shapes.
- `move_reasons.c'
This file contains the code which assigns values to every move
after all the move reasons are gen
- `optics.c'
This file contains the code to recognize eye shapes,
documented in See section 11. Eyes and Half Eyes.
- `owl.c'
This file does life and death reading. The paradigm is that moves
are played by both players trying to expand and shrink the eyespace
until a static configuration is reached where it can be analyzed
by the code in `optics.c' or `life.c'.
- `printutils.c'
Print utilities
- `reading.c'
This file contains code to determine whether any given
string can be attacked or defended. See section 14. Tactical reading,
for details.
- `score.c'
Implements the Bouzy algorithms (see section 17. Moyo) and contains
code for scoring the game.
- `semeai.c'
This file contains semeai(), the module which tries to
win capturing races. This module does not work particularly
well and will eventually be replaced.
- `shapes.c'
This file contains shapes(), the module called by genmove()
which tries to find moves which match a pattern (see section 12. The Pattern Code).
- `showbord.c'
This file contains showboard(), which draws an ASCII
representation of the board, depicting dragons (stones
with same letter) and status (color). This was the
primary interface in GNU Go 1.2, but is now a debugging
aid.
- `worm.c'
This file contains make_worms(), code which is run at the
beginning of each move cycle, before the code in `dragon.c', to
determine the attributes of every string. These attributes are things
like liberties, wether the string can be captured (and how), etc
- `utils.c'
An assortment of utilities, described in greater detail below.