|
大家一起动手来充实gungo的定式库
12.16 The Joseki Compiler
GNU Go includes a joseki compiler in `patterns/joseki.c'. This processes an SGF file (with variations) and produces a sequence of patterns which can then be fed back into mkpat. The joseki database is currently in files in `patterns/' called `hoshi.sgf', `komoku.sgf', `sansan.sgf', `mokuhazushi.sgf' and `takamoku.sgf'. This division can be revised whenever need arises.
The SGF files are transformed into the pattern database `.db' format by the program in `joseki.c'. These files are in turn transformed into C code by the program in `mkpat.c' and the C files are compiled and linked into the GNU Go binary.
Not every node in the SGF file contributes a pattern. The nodes which contribute patterns have the joseki in the upper right corner, with the boundary marked with a square mark and other information to determine the resulting pattern marked in the comments.
The intention is that the move valuation should be able to choose between the available variations by normal valuation. When this fails the primary workaround is to use shape values to increase or decrease the value. It is also possible to add antisuji variations to forbid popular suboptimal moves. As usual constraints can be used, e.g. to condition a variation on a working ladder.
The joseki format has the following components for each SGF node:
A square mark (SQ or MA property) to decide how large part of the board should be included in the pattern.
A move (`W' or `B' property) with the natural interpretation. If the square mark is missing or the move is a pass, no pattern is produced for the node.
Optional labels (LB property), which must be a single letter each. If there is at least one label, a constraint diagram will be produced with these labels.
A comment (`C' property). As the first character it should have one of the following characters to decide its classification:
`U' - urgent move
`S' or `J' - standard move
`s' or `j' - lesser joseki
`T' - trick move
`t' - minor joseki move (tenuki OK)
`0' - antisuji (`A' can also be used)
The rest of the line is ignored, as is the case of the letter. If neither of these is found, it's assumed to be a standard joseki move.
In addition to this, rows starting with the following characters are recognized:
`#' - Comments. These are copied into the patterns file, above the diagram.
`;' - Constraints. These are copied into the patterns file, below the constraint diagram.
`>' - Actions. These are copied into the patterns file, below the constraint diagram.
`:' - Colon line. This is a little more complicated, but the colon line of the produced patterns always start out with ":8,s" for transformation number and sacrifice pattern class (it usually isn't a sacrifice, but it's pointless spending time checking for tactical safety). Then a joseki pattern class character is appended and finally what is included on the colon line in the comment for the SGF node.
|
|