[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [computer-go] Pattern Matcher (was M.Boon-Library)
Mark Boon wrote:
> ...But a pattern-editor is useless if it can't edit some crucial extra
> information that I need to store with it...
GNU Go patterns are stored in plain text files, which are then converted
into C sources by a utility program. This means you can use any text
editor as a pattern editor, even if not particularly convenient one.
Additional information is stored as C-style expressions (though not real
C). Here is a real example of a pattern:
Pattern A1106
OO.?
XOX* capture cutting stone to defend
xYO.
xx..
----
:8,C,value(70)
OO.?
XOB*
xAa.
xx..
----
;!attack(A) && attack(a) && !oplay_defend(*,B)
First goes the pattern name (GNU Go shows it in traces, so we can jump
right to the pattern which e.g. suggests a bad move.) Then comes the
pattern diagram with a short comment.
. --- empty
O --- player's stone
o --- player's stone or empty
X --- opponent's stone
x --- opponent's stone or empty
? --- anything
* --- empty; a move here is suggested
- --- board edge
The line started with colon gives a few attributes to the pattern: no
symmetry, the move can cut the attacked dragon apart, value 70 (high.)
After that a second (constraint) diagram comes. The only purpose of
this diagram is to define labels with respect to the pattern. Otherwise
it must match the main diagram.
Finally comes the C-style constraint. It can be read like this:
Match pattern if the opponent string at 'A' cannot be tactically
attacked, our lone stone at 'a' can be and if the opponent cannot
defend the 'B' stone after we play at '*'.
I think this constraint style is very powerful for hand-written patterns.
You can always add more pseudo-functions and you are virtually unlimited
in what you evaluate here.
Paul
_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://www.computer-go.org/mailman/listinfo/computer-go/