1 |
root |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
root |
1.2 |
Games::Go::SGF::Grove - SGF the Perl way |
4 |
root |
1.1 |
|
5 |
|
|
=head1 SYNOPSIS |
6 |
|
|
|
7 |
|
|
use Games::Go::SGF::Grove; |
8 |
root |
1.2 |
|
9 |
|
|
$game = load_sgf $path; |
10 |
|
|
save_sgf $path, $game; |
11 |
|
|
|
12 |
|
|
$game = decode_sgf $sgf_data; |
13 |
|
|
$sgf_data = encode_sgf $game; |
14 |
root |
1.1 |
|
15 |
|
|
=head1 DESCRIPTION |
16 |
|
|
|
17 |
root |
1.2 |
This module loads and saves Go SGF files. Unlike other modules, it doesn't |
18 |
|
|
build a very fancy data structure with lot's of java-like accessors |
19 |
|
|
but instead returns a simple Perl data structure you can inspect with |
20 |
|
|
Data::Dumper and modify easily. The structure follows the SGF file format |
21 |
|
|
very closely. |
22 |
|
|
|
23 |
|
|
The SGF format is documented here: L<http://www.red-bean.com/sgf/>. |
24 |
|
|
|
25 |
|
|
All the functions below use a common data format and throw exceptions on |
26 |
|
|
any errors. |
27 |
root |
1.1 |
|
28 |
|
|
=over 4 |
29 |
|
|
|
30 |
|
|
=cut |
31 |
|
|
|
32 |
|
|
package Games::Go::SGF::Grove; |
33 |
|
|
|
34 |
root |
1.2 |
use strict; |
35 |
|
|
no warnings; |
36 |
|
|
|
37 |
root |
1.7 |
use Carp; |
38 |
|
|
|
39 |
root |
1.8 |
use base Exporter::; |
40 |
root |
1.7 |
|
41 |
root |
1.2 |
our $VERSION = 0.1; |
42 |
|
|
our @EXPORT = qw(load_sgf save_sgf encode_sgf decode_sgf); |
43 |
|
|
|
44 |
|
|
=item $game = load_sgf $path |
45 |
|
|
|
46 |
|
|
Tries to read the file given by C<$path> and parses it as an SGF file, |
47 |
|
|
returning the parsed data structure. |
48 |
|
|
|
49 |
|
|
=item save_sgf $path, $game |
50 |
|
|
|
51 |
|
|
Saves the SGF data to the specified file. |
52 |
|
|
|
53 |
|
|
=item $game = decode_sgf $sgf_data |
54 |
|
|
|
55 |
|
|
Tries to parse the given string into a Pelr data structure and returns it. |
56 |
|
|
|
57 |
|
|
=item $sgf_data = encode_sgf $game |
58 |
|
|
|
59 |
|
|
Takes a Perl data structure and serialises it into an SGF file. Anything |
60 |
|
|
stored in the structure that isn't understood by this module will be |
61 |
|
|
silently ignored. |
62 |
|
|
|
63 |
|
|
=cut |
64 |
|
|
|
65 |
|
|
sub decode_sgf($) { |
66 |
|
|
my ($sgf_data) = @_; |
67 |
root |
1.3 |
|
68 |
root |
1.4 |
Games::Go::SGF::Grove::Parser::->new->decode_sgf ($sgf_data) |
69 |
root |
1.2 |
} |
70 |
|
|
|
71 |
|
|
sub encode_sgf($) { |
72 |
|
|
my ($game) = @_; |
73 |
root |
1.4 |
|
74 |
|
|
Games::Go::SGF::Grove::Parser::->new->encode_sgf ($game) |
75 |
root |
1.2 |
} |
76 |
|
|
|
77 |
|
|
sub load_sgf($) { |
78 |
|
|
my ($path) = @_; |
79 |
|
|
|
80 |
|
|
open my $fh, "<:perlio", $path |
81 |
root |
1.7 |
or Carp::croak "$path: $!"; |
82 |
root |
1.2 |
|
83 |
|
|
local $/; |
84 |
root |
1.3 |
decode_sgf <$fh> |
85 |
root |
1.2 |
} |
86 |
|
|
|
87 |
|
|
sub save_sgf($$) { |
88 |
|
|
my ($path, $game) = @_; |
89 |
|
|
|
90 |
root |
1.4 |
open my $fh, ">:perlio", $path |
91 |
root |
1.7 |
or Carp::croak "$path: $!"; |
92 |
root |
1.2 |
|
93 |
|
|
print $fh encode_sgf $game; |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
=back |
97 |
|
|
|
98 |
|
|
=head2 The Game Data structure |
99 |
|
|
|
100 |
|
|
The SGF game is represented by a linked Perl data structure consisting of |
101 |
|
|
unblessed hashes and arrays. |
102 |
|
|
|
103 |
root |
1.4 |
SGF files are a forest of trees, called a collection (i.e. you can have |
104 |
|
|
multiple games stored in a file). The C<load_sgf> and C<decode_sgf> |
105 |
|
|
functions returns this collection as a reference to an array containing |
106 |
|
|
the individual game trees (usually there is only one, though). |
107 |
|
|
|
108 |
|
|
Each individual tree is again an array of nodes representing the main line |
109 |
|
|
of play. |
110 |
|
|
|
111 |
|
|
Each node is simply a hash reference. Each SGF property is stored with the |
112 |
|
|
(uppercase) property name as the key, and a property-dependent value for |
113 |
|
|
the contents (e.g., a black move is stored as C<< B => [3, 5] >>. |
114 |
|
|
|
115 |
|
|
If there are any variations/branches/alternate lines of play, then these |
116 |
|
|
are stored in the array reference in the C<variations> key (those again |
117 |
|
|
are game trees, so array references themselves). |
118 |
|
|
|
119 |
|
|
This module reserves all uppercase key names for SGF properties, the key |
120 |
|
|
C<variations> and all keys starting with an underscore (C<_xxx>) as it's |
121 |
|
|
own. Users of this module may store additional attributes that don't |
122 |
|
|
conflict with these names in any node. |
123 |
|
|
|
124 |
|
|
Unknown properties will be stored as scalars with the (binary) property |
125 |
|
|
contents. Text nodes will always be decoded into Unicode text and encoded |
126 |
|
|
into whatever the CA property of the root node says (default: C<UTF-8>). |
127 |
|
|
|
128 |
|
|
When saving, all uppercase keys will be saved, lowercase keys will be |
129 |
|
|
ignored. |
130 |
|
|
|
131 |
|
|
For the actual encoding of other types, best decode some example game that |
132 |
|
|
contains them and use Data::Dumper. Here is such an example: |
133 |
|
|
|
134 |
|
|
[ # list of game-trees, only one here |
135 |
|
|
[ # the main node sequence |
136 |
|
|
{ # the root node, contains some variations |
137 |
|
|
DI => '7k', |
138 |
|
|
AP => undef, |
139 |
|
|
CO => '5', |
140 |
|
|
DP => '40', |
141 |
|
|
GE => 'tesuji', |
142 |
|
|
AW => [ |
143 |
|
|
[ 2, 16 ], [ 3, 15 ], [ 15, 9 ], [ 14, 13 ], ... |
144 |
|
|
], |
145 |
|
|
C => 'White just played a ladder block at h12.', |
146 |
|
|
variations => [ # list of variations, only one |
147 |
|
|
[ # sequence of variation moves |
148 |
|
|
{ B => [ 7, 5 ] }, # a black move |
149 |
|
|
{ W => [ 12, 12 ] }, # a white move |
150 |
|
|
... and so on |
151 |
|
|
] |
152 |
|
|
], |
153 |
|
|
} |
154 |
|
|
] |
155 |
|
|
} |
156 |
root |
1.2 |
|
157 |
|
|
=cut |
158 |
|
|
|
159 |
|
|
package Games::Go::SGF::Grove::Parser; |
160 |
root |
1.1 |
|
161 |
|
|
no warnings; |
162 |
root |
1.4 |
use strict 'vars'; |
163 |
|
|
|
164 |
|
|
use Encode (); |
165 |
|
|
use Carp qw(croak); |
166 |
root |
1.1 |
|
167 |
|
|
my $ws = qr{[\x00-\x20]*}s; |
168 |
|
|
my $property; # property => propertyinfo |
169 |
|
|
|
170 |
|
|
sub new { |
171 |
|
|
my $class = shift; |
172 |
|
|
bless { @_ }, $class; |
173 |
|
|
} |
174 |
|
|
|
175 |
|
|
sub error { |
176 |
|
|
my ($self, $error) = @_; |
177 |
|
|
|
178 |
root |
1.4 |
my $pos = pos $self->{sgf}; |
179 |
|
|
|
180 |
|
|
my $tail = substr $self->{sgf}, $pos, 32; |
181 |
root |
1.1 |
$tail =~ s/[\x00-\x1f]+/ /g; |
182 |
|
|
|
183 |
root |
1.4 |
croak "$error (at octet $pos, '$tail')"; |
184 |
root |
1.1 |
} |
185 |
|
|
|
186 |
root |
1.4 |
sub decode_sgf { |
187 |
root |
1.1 |
my ($self, $sgf) = @_; |
188 |
|
|
|
189 |
|
|
# correct lines |
190 |
|
|
if ($sgf =~ /[^\015\012]\015/) { |
191 |
|
|
$sgf =~ s/\015\012?/\n/g; |
192 |
|
|
} else { |
193 |
|
|
$sgf =~ s/\012\015?/\n/g; |
194 |
|
|
} |
195 |
|
|
|
196 |
|
|
$self->{sgf} = $sgf; |
197 |
|
|
|
198 |
|
|
$self->{FF} = 1; |
199 |
root |
1.4 |
$self->{CA} = 'WINDOWS-1252'; # too many files are |
200 |
root |
1.1 |
$self->{GM} = 1; |
201 |
|
|
|
202 |
|
|
my @trees; |
203 |
|
|
|
204 |
|
|
eval { |
205 |
|
|
while ($self->{sgf} =~ /\G$ws(?=\()/sgoc) { |
206 |
root |
1.4 |
push @trees, $self->decode_GameTree; |
207 |
root |
1.1 |
} |
208 |
|
|
}; |
209 |
|
|
|
210 |
root |
1.4 |
croak $@ if $@; |
211 |
root |
1.1 |
|
212 |
|
|
\@trees |
213 |
|
|
} |
214 |
|
|
|
215 |
root |
1.4 |
sub decode_GameTree { |
216 |
root |
1.1 |
my ($self) = @_; |
217 |
|
|
|
218 |
|
|
$self->{sgf} =~ /\G$ws\(/sgoc |
219 |
|
|
or $self->error ("GameTree does not start with '('"); |
220 |
|
|
|
221 |
root |
1.4 |
my $nodes = $self->decode_Sequence; |
222 |
root |
1.1 |
|
223 |
|
|
while ($self->{sgf} =~ /\G$ws(?=\()/sgoc) { |
224 |
root |
1.4 |
push @{$nodes->[-1]{variations}}, $self->decode_GameTree; |
225 |
root |
1.1 |
} |
226 |
|
|
$self->{sgf} =~ /\G$ws\)/sgoc |
227 |
|
|
or $self->error ("GameTree does not end with ')'"); |
228 |
|
|
|
229 |
|
|
$nodes |
230 |
|
|
} |
231 |
|
|
|
232 |
root |
1.4 |
sub postprocess { |
233 |
|
|
my $self = shift; |
234 |
|
|
|
235 |
|
|
for (@_) { |
236 |
|
|
if ("ARRAY" eq ref) { |
237 |
|
|
$self->postprocess (@$_); |
238 |
|
|
} elsif ("HASH" eq ref) { |
239 |
|
|
if (my $value = $_->{_text}) { |
240 |
root |
1.6 |
$value =~ s/\\\n/ /g; |
241 |
root |
1.5 |
$value =~ s/\\(.)/$1/g; |
242 |
root |
1.4 |
$_ = eval { Encode::decode $self->{CA}, $value } || $value |
243 |
|
|
} else { |
244 |
|
|
$self->postprocess (values %$_); |
245 |
|
|
} |
246 |
|
|
} |
247 |
|
|
} |
248 |
|
|
} |
249 |
|
|
|
250 |
|
|
sub decode_Sequence { |
251 |
root |
1.1 |
my ($self) = @_; |
252 |
|
|
|
253 |
root |
1.4 |
my (@nodes, $node, $name, $value, $prop, @val); |
254 |
root |
1.1 |
|
255 |
|
|
while ($self->{sgf} =~ /\G$ws;/goc) { |
256 |
|
|
push @nodes, $node = {}; |
257 |
|
|
# Node |
258 |
|
|
while ($self->{sgf} =~ /\G$ws([A-Z]+)/goc) { |
259 |
|
|
# Property |
260 |
|
|
$name = $1; |
261 |
root |
1.4 |
$prop = $property->{$name}; |
262 |
root |
1.1 |
|
263 |
|
|
while ($self->{sgf} =~ /\G$ws\[((?:[^\\\]]*|\\.)*)\]/sgoc) { |
264 |
|
|
# PropValue |
265 |
|
|
$value = $1; |
266 |
root |
1.4 |
if ($prop) { |
267 |
|
|
@val = $prop->{in}->($self, $value, $prop); |
268 |
root |
1.1 |
|
269 |
|
|
if ($prop->{is_list}) { |
270 |
|
|
push @{$node->{$name}}, @val |
271 |
|
|
} else { |
272 |
|
|
$node->{$name} = $val[0]; |
273 |
root |
1.4 |
|
274 |
|
|
$self->{CA} = $val[0] if $name eq "CA"; |
275 |
root |
1.1 |
} |
276 |
|
|
} else { |
277 |
root |
1.3 |
#warn "unknown property '$name', will be saved unchanged.";#d# |
278 |
root |
1.4 |
push @{$node->{$name}}, $value; |
279 |
root |
1.1 |
} |
280 |
|
|
} |
281 |
|
|
} |
282 |
root |
1.4 |
|
283 |
|
|
# postprocess nodes, currently only to decode text and simpletext |
284 |
|
|
$self->postprocess ($node); |
285 |
root |
1.1 |
} |
286 |
|
|
|
287 |
|
|
\@nodes |
288 |
|
|
} |
289 |
|
|
|
290 |
root |
1.4 |
sub encode_sgf($) { |
291 |
|
|
my ($self, $game) = @_; |
292 |
|
|
|
293 |
|
|
$self->{sgf} = ""; |
294 |
|
|
|
295 |
|
|
$self->{FF} = 4; |
296 |
|
|
$self->{CA} = 'UTF-8'; |
297 |
|
|
$self->{GM} = 1; |
298 |
|
|
$self->{AP} = ["Games::Go::SGF::Grove", $VERSION]; |
299 |
|
|
|
300 |
|
|
$self->encode_GameTree ($_, 1) for @$game; |
301 |
|
|
|
302 |
|
|
$self->{sgf} |
303 |
|
|
} |
304 |
|
|
|
305 |
|
|
sub encode_GameTree { |
306 |
|
|
my ($self, $sequence, $is_root) = @_; |
307 |
|
|
|
308 |
|
|
if ($is_root) { |
309 |
|
|
my $root = $sequence->[0]; |
310 |
|
|
|
311 |
|
|
$root->{CA} ||= $self->{CA}; |
312 |
|
|
$root->{FF} ||= $self->{FF}; |
313 |
|
|
$root->{GM} ||= $self->{GM}; |
314 |
|
|
$root->{AP} ||= $self->{AP}; |
315 |
|
|
|
316 |
|
|
$self->{CA} = $root->{CA}; |
317 |
|
|
} |
318 |
|
|
|
319 |
|
|
$self->{sgf} .= "("; |
320 |
|
|
$self->encode_Sequence ($sequence); |
321 |
|
|
$self->{sgf} .= ")"; |
322 |
|
|
} |
323 |
|
|
|
324 |
|
|
sub encode_Sequence { |
325 |
|
|
my ($self, $sequence) = @_; |
326 |
|
|
|
327 |
root |
1.8 |
my ($value, $prop); |
328 |
|
|
|
329 |
root |
1.4 |
for my $node (@$sequence) { |
330 |
|
|
$self->{sgf} .= ";"; |
331 |
|
|
|
332 |
root |
1.8 |
for my $name (sort keys %$node) { |
333 |
root |
1.4 |
next unless $name eq uc $name; |
334 |
|
|
|
335 |
root |
1.8 |
$value = $node->{$name}; |
336 |
|
|
|
337 |
root |
1.4 |
$self->{sgf} .= "$name\["; |
338 |
|
|
|
339 |
root |
1.8 |
if ($prop = $property->{$name}) { |
340 |
root |
1.4 |
if ($prop->{is_list}) { |
341 |
|
|
$self->{sgf} .= join "][", map $prop->{out}->($self, $_), @$value; |
342 |
|
|
} else { |
343 |
|
|
$self->{sgf} .= $prop->{out}->($self, $value); |
344 |
|
|
} |
345 |
|
|
} else { |
346 |
elmex |
1.9 |
$self->{sgf} .= |
347 |
|
|
ref $value |
348 |
|
|
? join "][", @$value |
349 |
|
|
: $value; |
350 |
root |
1.4 |
} |
351 |
|
|
|
352 |
|
|
$self->{sgf} .= "]"; |
353 |
|
|
} |
354 |
|
|
|
355 |
|
|
$self->encode_GameTree ($_) for @{ $node->{variations} }; |
356 |
|
|
} |
357 |
|
|
} |
358 |
|
|
|
359 |
root |
1.1 |
############################################################################# |
360 |
|
|
|
361 |
|
|
=head2 Property Type Structure |
362 |
|
|
|
363 |
|
|
A property type is a hash like this: |
364 |
|
|
|
365 |
|
|
{ |
366 |
|
|
name => "SQ", |
367 |
|
|
group => { |
368 |
|
|
name => "Markup properties", |
369 |
|
|
restrictions => "CR, MA, SL, SQ and TR points must be unique, ...", |
370 |
|
|
}, |
371 |
|
|
related => "TR, CR, LB, SL, AR, MA, LN", |
372 |
|
|
function => "Marks the given points with a square.\nPoints must be unique.", |
373 |
|
|
propertytype => "-", |
374 |
|
|
propvalue => "list of point" |
375 |
|
|
is_list => 1, |
376 |
|
|
} |
377 |
|
|
|
378 |
|
|
=cut |
379 |
|
|
|
380 |
|
|
|
381 |
|
|
{ |
382 |
|
|
my ($group, $name, $value, $prop); |
383 |
|
|
|
384 |
|
|
my (%char2coord, %coord2char); |
385 |
|
|
|
386 |
|
|
{ |
387 |
|
|
my @coord = ("a" .. "z", "A" .. "Z"); |
388 |
root |
1.4 |
|
389 |
root |
1.1 |
for (0.. $#coord) { |
390 |
|
|
$char2coord{ $coord[$_] } = $_; |
391 |
|
|
$coord2char{ $_ } = $coord[$_]; |
392 |
|
|
} |
393 |
|
|
} |
394 |
|
|
|
395 |
root |
1.3 |
sub _parsetype($); |
396 |
root |
1.1 |
sub _parsetype { |
397 |
|
|
for (shift) { |
398 |
|
|
if (s/e?list of //) { |
399 |
|
|
$prop->{is_list} = 1; |
400 |
root |
1.3 |
return _parsetype $_; |
401 |
root |
1.4 |
|
402 |
root |
1.1 |
} elsif (s/composed (\S+)\s+(?:':'\s+)?(\S+)//) { |
403 |
root |
1.4 |
$prop->{composed} = 1; |
404 |
root |
1.1 |
my ($i, $o) = ($1, $2); |
405 |
root |
1.3 |
my ($i1, $o1, $i2, $o2) = (_parsetype $i, _parsetype $o); |
406 |
root |
1.1 |
return ( |
407 |
|
|
sub { |
408 |
elmex |
1.10 |
if ($_[1] =~ /^((?:[^\\:]+|\\.)*)(?::(.*))?$/s) { |
409 |
root |
1.1 |
# or $_[0]->error ("'Compose' ($i:$o) expected, got '$_[1]'"); |
410 |
|
|
my ($l, $r) = ($1, $2); |
411 |
|
|
|
412 |
|
|
[ |
413 |
|
|
$i1->($_[0], $l), |
414 |
|
|
defined $r ? $i2->($_[0], $r) : undef, |
415 |
root |
1.4 |
] |
416 |
root |
1.1 |
} |
417 |
|
|
}, |
418 |
|
|
sub { |
419 |
|
|
$o1->($_[0], $_[1][0]) |
420 |
root |
1.4 |
. ":" |
421 |
|
|
. $o2->($_[0], $_[1][1]) |
422 |
root |
1.1 |
}, |
423 |
|
|
); |
424 |
root |
1.4 |
|
425 |
root |
1.1 |
} elsif (s/double//) { |
426 |
|
|
return ( |
427 |
|
|
sub { |
428 |
|
|
$_[1] =~ /^[12]$/ |
429 |
root |
1.3 |
or $_[0]->error ("'Double' (1|2) expected, got '$_[1]'"); |
430 |
root |
1.1 |
$_[1] |
431 |
|
|
}, |
432 |
|
|
sub { |
433 |
|
|
$_[1] |
434 |
|
|
}, |
435 |
|
|
); |
436 |
|
|
} elsif (s/color//) { |
437 |
|
|
return ( |
438 |
|
|
sub { |
439 |
root |
1.4 |
# too many broken programs write this wrong |
440 |
|
|
return "B" if $_[1] eq "1"; |
441 |
|
|
return "W" if $_[1] eq "2"; |
442 |
|
|
|
443 |
root |
1.1 |
$_[1] =~ /^[BW]$/i |
444 |
root |
1.3 |
or $_[0]->error ("'Color' (B|W) expected, got '$_[1]'"); |
445 |
root |
1.1 |
lc $_[1] |
446 |
|
|
}, |
447 |
|
|
sub { |
448 |
|
|
uc $_[1] |
449 |
|
|
}, |
450 |
|
|
); |
451 |
|
|
} elsif (s/none//) { |
452 |
|
|
return ( |
453 |
|
|
sub { |
454 |
|
|
$_[1] =~ /^$/i |
455 |
root |
1.3 |
or $_[0]->error ("'None' expected, got '$_[1]'"); |
456 |
root |
1.1 |
undef |
457 |
|
|
}, |
458 |
|
|
sub { |
459 |
|
|
"", |
460 |
|
|
}, |
461 |
|
|
); |
462 |
|
|
} elsif (s/point// || s/move// || s/stone//) { |
463 |
|
|
return ( |
464 |
|
|
sub { |
465 |
|
|
if ($_[2]->{is_list}) { |
466 |
|
|
if ($_[1] =~ /^([^:]+):(.*)$/) { |
467 |
|
|
my ($ul, $dr) = ($1, $2); |
468 |
|
|
my ($x1, $y1) = map $char2coord{$_}, split //, $ul; |
469 |
|
|
my ($x2, $y2) = map $char2coord{$_}, split //, $dr; |
470 |
|
|
my @stones; |
471 |
|
|
for (my $d = $x1; $d < $x2; $d++) { |
472 |
|
|
for (my $i = $y1; $i < $y2; $i++) { |
473 |
|
|
push @stones, [$d, $i]; |
474 |
|
|
} |
475 |
|
|
} |
476 |
|
|
return @stones; |
477 |
|
|
} |
478 |
|
|
} |
479 |
|
|
$_[1] =~ /^(.)(.)$/ |
480 |
|
|
? [ $char2coord{$1}, $char2coord{$2} ] |
481 |
|
|
: [] |
482 |
|
|
}, |
483 |
|
|
sub { |
484 |
root |
1.4 |
$coord2char{$_[1][0]} . $coord2char{$_[1][1]} |
485 |
root |
1.1 |
}, |
486 |
|
|
); |
487 |
|
|
} elsif (s/real//) { |
488 |
|
|
return ( |
489 |
|
|
sub { |
490 |
elmex |
1.13 |
$_[1]+0 |
491 |
root |
1.1 |
}, |
492 |
|
|
sub { |
493 |
root |
1.4 |
$_[1]+0 |
494 |
root |
1.1 |
}, |
495 |
|
|
); |
496 |
|
|
} elsif (s/number//) { |
497 |
|
|
return ( |
498 |
|
|
sub { |
499 |
elmex |
1.13 |
$_[1]+0 |
500 |
root |
1.1 |
}, |
501 |
|
|
sub { |
502 |
root |
1.4 |
int $_[1] |
503 |
root |
1.1 |
}, |
504 |
|
|
); |
505 |
root |
1.4 |
} elsif (s/text// || s/simpletext//i) { |
506 |
root |
1.1 |
return ( |
507 |
|
|
sub { |
508 |
root |
1.4 |
{ _text => $_[1] } |
509 |
root |
1.1 |
}, |
510 |
|
|
sub { |
511 |
root |
1.4 |
my $str = Encode::encode $_[0]{CA}, $_[1]; |
512 |
|
|
$str =~ s/([\:\]\\])/\\$1/g; |
513 |
|
|
$str |
514 |
root |
1.1 |
}, |
515 |
|
|
); |
516 |
|
|
} else { |
517 |
|
|
die "FATAL: garbled DATA section, unknown type '$_'"; |
518 |
|
|
} |
519 |
|
|
} |
520 |
|
|
} |
521 |
|
|
|
522 |
|
|
while (<DATA>) { |
523 |
|
|
if (/^(\S+):\t(.*)/) { |
524 |
|
|
if ($name eq "Restrictions") { |
525 |
|
|
$group->{restrictions} = $value; |
526 |
|
|
} elsif ($name eq "Property") { |
527 |
|
|
$property->{$value} = |
528 |
|
|
$prop = { |
529 |
|
|
name => $value, |
530 |
|
|
group => $group, |
531 |
|
|
}; |
532 |
|
|
} elsif ($name ne "") { |
533 |
|
|
$prop->{lc $name} = $value; |
534 |
|
|
if ($name eq "Propvalue") { |
535 |
|
|
($prop->{in}, $prop->{out}) = _parsetype $value; |
536 |
|
|
} |
537 |
|
|
} |
538 |
|
|
$name = $1; |
539 |
|
|
$value = $2; |
540 |
|
|
} elsif (/^\t\t(.*)/) { |
541 |
|
|
$value .= "\n$1"; |
542 |
|
|
} elsif (/(\S.*)/) { |
543 |
|
|
$group = { |
544 |
|
|
name => $1, |
545 |
|
|
}; |
546 |
|
|
} elsif (/^$/) { |
547 |
|
|
# nop |
548 |
|
|
} else { |
549 |
|
|
die "FATAL: DATA section garbled\n"; |
550 |
|
|
} |
551 |
|
|
} |
552 |
|
|
} |
553 |
|
|
|
554 |
|
|
1; |
555 |
|
|
|
556 |
|
|
=head1 AUTHOR |
557 |
|
|
|
558 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
559 |
|
|
Robin Redeker <elmex@ta-sa.org> |
560 |
|
|
|
561 |
|
|
=cut |
562 |
|
|
|
563 |
|
|
# now node descriptions follow |
564 |
|
|
|
565 |
|
|
__DATA__ |
566 |
|
|
Move properties |
567 |
|
|
|
568 |
|
|
Property: B |
569 |
|
|
Propvalue: move |
570 |
|
|
Propertytype: move |
571 |
|
|
Function: Execute a black move. This is one of the most used properties |
572 |
|
|
in actual collections. As long as |
573 |
|
|
the given move is syntactically correct it should be executed. |
574 |
|
|
It doesn't matter if the move itself is illegal |
575 |
|
|
(e.g. recapturing a ko in a Go game). |
576 |
|
|
Have a look at how to execute a Go-move. |
577 |
|
|
B and W properties must not be mixed within a node. |
578 |
|
|
Related: W, KO |
579 |
|
|
|
580 |
|
|
Property: KO |
581 |
|
|
Propvalue: none |
582 |
|
|
Propertytype: move |
583 |
|
|
Function: Execute a given move (B or W) even it's illegal. This is |
584 |
|
|
an optional property, SGF viewers themselves should execute |
585 |
|
|
ALL moves. It's purpose is to make it easier for other |
586 |
|
|
applications (e.g. computer-players) to deal with illegal |
587 |
|
|
moves. A KO property without a black or white move within |
588 |
|
|
the same node is illegal. |
589 |
|
|
Related: W, B |
590 |
|
|
|
591 |
|
|
Property: MN |
592 |
|
|
Propvalue: number |
593 |
|
|
Propertytype: move |
594 |
|
|
Function: Sets the move number to the given value, i.e. a move |
595 |
|
|
specified in this node has exactly this move-number. This |
596 |
|
|
can be useful for variations or printing. |
597 |
|
|
Related: B, W, FG, PM |
598 |
|
|
|
599 |
|
|
Property: W |
600 |
|
|
Propvalue: move |
601 |
|
|
Propertytype: move |
602 |
|
|
Function: Execute a white move. This is one of the most used properties |
603 |
|
|
in actual collections. As long as |
604 |
|
|
the given move is syntactically correct it should be executed. |
605 |
|
|
It doesn't matter if the move itself is illegal |
606 |
|
|
(e.g. recapturing a ko in a Go game). |
607 |
|
|
Have a look at how to execute a Go-move. |
608 |
|
|
B and W properties must not be mixed within a node. |
609 |
|
|
Related: B, KO |
610 |
|
|
|
611 |
|
|
Setup properties |
612 |
|
|
Restrictions: AB, AW and AE must have unique points, i.e. it is illegal to place different colors on the same point within one node. |
613 |
|
|
AB, AW and AE values which don't change the board, e.g. placing a black stone with AB[] over a black stone that's already there, is bad style. Applications may want to delete these values and issue a warning. |
614 |
|
|
|
615 |
|
|
Property: AB |
616 |
|
|
Propvalue: list of stone |
617 |
|
|
Propertytype: setup |
618 |
|
|
Function: Add black stones to the board. This can be used to set up |
619 |
|
|
positions or problems. Adding is done by 'overwriting' the |
620 |
|
|
given point with black stones. It doesn't matter what |
621 |
|
|
was there before. Adding a stone doesn't make any prisoners |
622 |
|
|
nor any other captures (e.g. suicide). Thus it's possible |
623 |
|
|
to create illegal board positions. |
624 |
|
|
Points used in stone type must be unique. |
625 |
|
|
Related: AW, AE, PL |
626 |
|
|
|
627 |
|
|
Property: AE |
628 |
|
|
Propvalue: list of point |
629 |
|
|
Propertytype: setup |
630 |
|
|
Function: Clear the given points on the board. This can be used |
631 |
|
|
to set up positions or problems. Clearing is done by |
632 |
|
|
'overwriting' the given points, so that they contain no |
633 |
|
|
stones. It doesn't matter what was there before. |
634 |
|
|
Clearing doesn't count as taking prisoners. |
635 |
|
|
Points must be unique. |
636 |
|
|
Related: AB, AW, PL |
637 |
|
|
|
638 |
|
|
Property: AW |
639 |
|
|
Propvalue: list of stone |
640 |
|
|
Propertytype: setup |
641 |
|
|
Function: Add white stones to the board. This can be used to set up |
642 |
|
|
positions or problems. Adding is done by 'overwriting' the |
643 |
|
|
given points with white stones. It doesn't matter what |
644 |
|
|
was there before. Adding a stone doesn't make any prisoners |
645 |
|
|
nor any other captures (e.g. suicide). Thus it's possible |
646 |
|
|
to create illegal board positions. |
647 |
|
|
Points used in stone type must be unique. |
648 |
|
|
Related: AB, AE, PL |
649 |
|
|
|
650 |
|
|
Property: PL |
651 |
|
|
Propvalue: color |
652 |
|
|
Propertytype: setup |
653 |
|
|
Function: PL tells whose turn it is to play. This can be used when |
654 |
|
|
setting up positions or problems. |
655 |
|
|
Related: AE, AB, AW |
656 |
|
|
|
657 |
|
|
Node annotation properties |
658 |
|
|
|
659 |
|
|
Property: C |
660 |
|
|
Propvalue: text |
661 |
|
|
Propertytype: - |
662 |
|
|
Function: Provides a comment text for the given node. The purpose of |
663 |
|
|
providing both a node name and a comment is to have a short |
664 |
|
|
identifier like "doesn't work" or "Dia. 15" that can be |
665 |
|
|
displayed directly with the properties of the node, even if |
666 |
|
|
the comment is turned off or shown in a separate window. |
667 |
|
|
See text-type for more info. |
668 |
|
|
Related: N, ST, V, UC, DM, HO |
669 |
|
|
|
670 |
|
|
Property: DM |
671 |
|
|
Propvalue: double |
672 |
|
|
Propertytype: - |
673 |
|
|
Function: The position is even. SGF viewers should display a |
674 |
|
|
message. This property may indicate main variations in |
675 |
|
|
opening libraries (joseki) too. Thus DM[2] indicates an |
676 |
|
|
even result for both players and that this is a main |
677 |
|
|
variation of this joseki/opening. |
678 |
|
|
This property must not be mixed with UC, GB or GW |
679 |
|
|
within a node. |
680 |
|
|
Related: UC, GW, GB |
681 |
|
|
|
682 |
|
|
Property: GB |
683 |
|
|
Propvalue: double |
684 |
|
|
Propertytype: - |
685 |
|
|
Function: Something good for black. SGF viewers should display a |
686 |
|
|
message. The property is not related to any specific place |
687 |
|
|
on the board, but marks the whole node instead. |
688 |
|
|
GB must not be mixed with GW, DM or UC within a node. |
689 |
|
|
Related: GW, C, UC, DM |
690 |
|
|
|
691 |
|
|
Property: GW |
692 |
|
|
Propvalue: double |
693 |
|
|
Propertytype: - |
694 |
|
|
Function: Something good for white. SGF viewers should display a |
695 |
|
|
message. The property is not related to any specific place |
696 |
|
|
on the board, but marks the whole node instead. |
697 |
|
|
GW must not be mixed with GB, DM or UC within a node. |
698 |
|
|
Related: GB, C, UC, DM |
699 |
|
|
|
700 |
|
|
Property: HO |
701 |
|
|
Propvalue: double |
702 |
|
|
Propertytype: - |
703 |
|
|
Function: Node is a 'hotspot', i.e. something interesting (e.g. |
704 |
|
|
node contains a game-deciding move). |
705 |
|
|
SGF viewers should display a message. |
706 |
|
|
The property is not related to any specific place |
707 |
|
|
on the board, but marks the whole node instead. |
708 |
|
|
Sophisticated applications could implement the navigation |
709 |
|
|
command next/previous hotspot. |
710 |
|
|
Related: GB, GW, C, UC, DM |
711 |
|
|
|
712 |
|
|
Property: N |
713 |
|
|
Propvalue: simpletext |
714 |
|
|
Propertytype: - |
715 |
|
|
Function: Provides a name for the node. For more info have a look at |
716 |
|
|
the C-property. |
717 |
|
|
Related: C, ST, V |
718 |
|
|
|
719 |
|
|
Property: UC |
720 |
|
|
Propvalue: double |
721 |
|
|
Propertytype: - |
722 |
|
|
Function: The position is unclear. SGF viewers should display a |
723 |
|
|
message. This property must not be mixed with DM, GB or GW |
724 |
|
|
within a node. |
725 |
|
|
Related: DM, GW, GB |
726 |
|
|
|
727 |
|
|
Property: V |
728 |
|
|
Propvalue: real |
729 |
|
|
Propertytype: - |
730 |
|
|
Function: Define a value for the node. Positive values are good for |
731 |
|
|
black, negative values are good for white. |
732 |
|
|
The interpretation of particular values is game-specific. |
733 |
|
|
In Go, this is the estimated score. |
734 |
|
|
Related: C, N, RE |
735 |
|
|
|
736 |
|
|
Move annotation properties |
737 |
|
|
Restrictions: Move annotation properties without a move (B[] or W[]) within the same node are senseless and therefore illegal. Applications should delete such properties and issue a warning. |
738 |
|
|
BM, TE, DO and IT are mutual exclusive, i.e. they must not be mixed within a single node. |
739 |
|
|
|
740 |
|
|
Property: BM |
741 |
|
|
Propvalue: double |
742 |
|
|
Propertytype: move |
743 |
|
|
Function: The played move is bad. |
744 |
|
|
Viewers should display a message. |
745 |
|
|
Related: TE, DO, IT |
746 |
|
|
|
747 |
|
|
Property: DO |
748 |
|
|
Propvalue: none |
749 |
|
|
Propertytype: move |
750 |
|
|
Function: The played move is doubtful. |
751 |
|
|
Viewers should display a message. |
752 |
|
|
Related: BM, TE, IT |
753 |
|
|
|
754 |
|
|
Property: IT |
755 |
|
|
Propvalue: none |
756 |
|
|
Propertytype: move |
757 |
|
|
Function: The played move is interesting. |
758 |
|
|
Viewers should display a message. |
759 |
|
|
Related: BM, DO, TE |
760 |
|
|
|
761 |
|
|
Property: TE |
762 |
|
|
Propvalue: double |
763 |
|
|
Propertytype: move |
764 |
|
|
Function: The played move is a tesuji (good move). |
765 |
|
|
Viewers should display a message. |
766 |
|
|
Related: BM, DO, IT |
767 |
|
|
|
768 |
|
|
Markup properties |
769 |
|
|
Restrictions: CR, MA, SL, SQ and TR points must be unique, i.e. it's illegal to have two or more of these markups on the same point within a node. |
770 |
|
|
|
771 |
|
|
Property: AR |
772 |
|
|
Propvalue: list of composed point point |
773 |
|
|
Propertytype: - |
774 |
|
|
Function: Viewers should draw an arrow pointing FROM the first point |
775 |
|
|
TO the second point. |
776 |
|
|
It's illegal to specify the same arrow twice, |
777 |
|
|
e.g. (Go) AR[aa:bb][aa:bb]. Different arrows may have the same |
778 |
|
|
starting or ending point though. |
779 |
|
|
It's illegal to specify a one point arrow, e.g. AR[cc:cc] |
780 |
|
|
as it's impossible to tell into which direction the |
781 |
|
|
arrow points. |
782 |
|
|
Related: TR, CR, LB, SL, MA, SQ, LN |
783 |
|
|
|
784 |
|
|
Property: CR |
785 |
|
|
Propvalue: list of point |
786 |
|
|
Propertytype: - |
787 |
|
|
Function: Marks the given points with a circle. |
788 |
|
|
Points must be unique. |
789 |
|
|
Related: TR, MA, LB, SL, AR, SQ, LN |
790 |
|
|
|
791 |
|
|
Property: DD |
792 |
|
|
Propvalue: elist of point |
793 |
|
|
Propertytype: inherit |
794 |
|
|
Function: Dim (grey out) the given points. |
795 |
|
|
DD[] clears any setting, i.e. it undims everything. |
796 |
|
|
Related: VW |
797 |
|
|
|
798 |
|
|
Property: LB |
799 |
|
|
Propvalue: list of composed point simpletext |
800 |
|
|
Propertytype: - |
801 |
|
|
Function: Writes the given text on the board. The text should be |
802 |
|
|
centered around the given point. Note: there's no longer |
803 |
|
|
a restriction to the length of the text to be displayed. |
804 |
|
|
Have a look at the FF4 example file on possibilities |
805 |
|
|
to display long labels (pictures five and six). |
806 |
|
|
Points must be unique. |
807 |
|
|
Related: TR, CR, MA, SL, AR, SQ, LN |
808 |
|
|
|
809 |
|
|
Property: LN |
810 |
|
|
Propvalue: list of composed point point |
811 |
|
|
Propertytype: - |
812 |
|
|
Function: Applications should draw a simple line form one point |
813 |
|
|
to the other. |
814 |
|
|
It's illegal to specify the same line twice, |
815 |
|
|
e.g. (Go) LN[aa:bb][aa:bb]. Different lines may have the same |
816 |
|
|
starting or ending point though. |
817 |
|
|
It's illegal to specify a one point line, e.g. LN[cc:cc]. |
818 |
|
|
Related: TR, CR, MA, SL, AR, SQ, LB |
819 |
|
|
|
820 |
|
|
|
821 |
|
|
Property: MA |
822 |
|
|
Propvalue: list of point |
823 |
|
|
Propertytype: - |
824 |
|
|
Function: Marks the given points with an 'X'. |
825 |
|
|
Points must be unique. |
826 |
|
|
Related: TR, CR, LB, SL, AR, SQ, LN |
827 |
|
|
|
828 |
|
|
Property: SL |
829 |
|
|
Propvalue: list of point |
830 |
|
|
Propertytype: - |
831 |
|
|
Function: Selected points. Type of markup unknown |
832 |
|
|
(though SGB inverts the colors of the given points). |
833 |
|
|
Points must be unique. |
834 |
|
|
Related: TR, CR, LB, MA, AR, LN |
835 |
|
|
|
836 |
|
|
Property: SQ |
837 |
|
|
Propvalue: list of point |
838 |
|
|
Propertytype: - |
839 |
|
|
Function: Marks the given points with a square. |
840 |
|
|
Points must be unique. |
841 |
|
|
Related: TR, CR, LB, SL, AR, MA, LN |
842 |
|
|
|
843 |
|
|
Property: TR |
844 |
|
|
Propvalue: list of point |
845 |
|
|
Propertytype: - |
846 |
|
|
Function: Marks the given points with a triangle. |
847 |
|
|
Points must be unique. |
848 |
|
|
Related: MA, CR, LB, SL, AR, LN |
849 |
|
|
|
850 |
|
|
Root properties |
851 |
|
|
|
852 |
|
|
Property: AP |
853 |
|
|
Propvalue: composed simpletext simpletext |
854 |
|
|
Propertytype: root |
855 |
|
|
Function: Provides the name and version number of the application used |
856 |
|
|
to create this gametree. |
857 |
|
|
The name should be unique and must not be changed for |
858 |
|
|
different versions of the same program. |
859 |
|
|
The version number itself may be of any kind, but the format |
860 |
|
|
used must ensure that by using an ordinary string-compare, |
861 |
|
|
one is able to tell if the version is lower or higher |
862 |
|
|
than another version number. |
863 |
|
|
Here's the list of known applications and their names: |
864 |
|
|
|
865 |
|
|
Application System Name |
866 |
|
|
--------------------------- ----------- -------------------- |
867 |
|
|
[CGoban:1.6.2] Unix CGoban |
868 |
|
|
[Hibiscus:2.1] Windows 95 Hibiscus Go Editor |
869 |
|
|
[IGS:5.0] Internet Go Server |
870 |
|
|
[Many Faces of Go:10.0] Windows 95 The Many Faces of Go |
871 |
|
|
[MGT:?] DOS/Unix MGT |
872 |
|
|
[NNGS:?] Unix No Name Go Server |
873 |
|
|
[Primiview:3.0] Amiga OS3.0 Primiview |
874 |
|
|
[SGB:?] Macintosh Smart Game Board |
875 |
|
|
[SmartGo:1.0] Windows SmartGo |
876 |
|
|
|
877 |
|
|
Related: FF, GM, SZ, ST, CA |
878 |
|
|
|
879 |
|
|
Property: CA |
880 |
|
|
Propvalue: simpletext |
881 |
|
|
Propertytype: root |
882 |
|
|
Function: Provides the used charset for SimpleText and Text type. |
883 |
|
|
Default value is 'ISO-8859-1' aka 'Latin1'. |
884 |
|
|
Only charset names (or their aliases) as specified in RFC 1345 |
885 |
|
|
(or updates thereof) are allowed. |
886 |
|
|
Basically this field uses the same names as MIME messages in |
887 |
|
|
their 'charset=' field (in Content-Type). |
888 |
|
|
RFC's can be obtained via FTP from DS.INTERNIC.NET, |
889 |
|
|
NIS.NSF.NET, WUARCHIVE.WUSTL.EDU, SRC.DOC.IC.AC.UK |
890 |
|
|
or FTP.IMAG.FR. |
891 |
|
|
Related: FF, C, text type |
892 |
|
|
|
893 |
|
|
Property: FF |
894 |
|
|
Propvalue: number (range: 1-4) |
895 |
|
|
Propertytype: root |
896 |
|
|
Function: Defines the used file format. For difference between those |
897 |
|
|
formats have a look at the history of SGF. |
898 |
|
|
Default value: 1 |
899 |
|
|
Applications must be able to deal with different file formats |
900 |
|
|
within a collection. |
901 |
|
|
Related: GM, SZ, ST, AP, CA |
902 |
|
|
|
903 |
|
|
Property: GM |
904 |
|
|
Propvalue: number (range: 1-16) |
905 |
|
|
Propertytype: root |
906 |
|
|
Function: Defines the type of game, which is stored in the current |
907 |
|
|
gametree. The property should help applications |
908 |
|
|
to reject games, they cannot handle. |
909 |
|
|
Valid numbers are: Go = 1, Othello = 2, chess = 3, |
910 |
|
|
Gomoku+Renju = 4, Nine Men's Morris = 5, Backgammon = 6, |
911 |
|
|
Chinese chess = 7, Shogi = 8, Lines of Action = 9, |
912 |
|
|
Ataxx = 10, Hex = 11, Jungle = 12, Neutron = 13, |
913 |
|
|
Philosopher's Football = 14, Quadrature = 15, Trax = 16, |
914 |
|
|
Tantrix = 17, Amazons = 18, Octi = 19, Gess = 20. |
915 |
|
|
Default value: 1 |
916 |
|
|
Different kind of games may appear within a collection. |
917 |
|
|
Related: FF, SZ, ST, AP, CA |
918 |
|
|
|
919 |
|
|
Property: ST |
920 |
|
|
Propvalue: number (range: 0-3) |
921 |
|
|
Propertytype: root |
922 |
|
|
Function: Defines how variations should be shown (this is needed to |
923 |
|
|
synchronize the comments with the variations). If ST is omitted |
924 |
|
|
viewers should offer the possibility to change the mode online. |
925 |
|
|
Basically most programs show variations in two ways: |
926 |
|
|
as markup on the board (if the variation contains a move) |
927 |
|
|
and/or as a list (in a separate window). |
928 |
|
|
The style number consists two options. |
929 |
|
|
1) show variations of successor node (children) (value: 0) |
930 |
|
|
show variations of current node (siblings) (value: 1) |
931 |
|
|
affects markup & list |
932 |
|
|
2) do board markup (value: 0) |
933 |
|
|
no (auto-) board markup (value: 2) |
934 |
|
|
affects markup only. |
935 |
|
|
Using no board markup could be used in problem collections |
936 |
|
|
or if variations are marked by subsequent properties. |
937 |
|
|
Viewers should take care, that the automatic variation |
938 |
|
|
board markup DOESN'T overwrite any markup of other |
939 |
|
|
properties. |
940 |
|
|
The final number is calculated by adding the values of each |
941 |
|
|
option. Example: 3 = no board markup/variations of current node |
942 |
|
|
1 = board markup/variations of current node |
943 |
|
|
Default value: 0 |
944 |
|
|
Related: C, FF, GM, SZ, AP, CA |
945 |
|
|
|
946 |
|
|
Property: SZ |
947 |
root |
1.4 |
Propvalue: number |
948 |
root |
1.1 |
Propertytype: root |
949 |
|
|
Function: Defines the size of the board. If only a single value |
950 |
|
|
is given, the board is a square; with two numbers given, |
951 |
|
|
rectangular boards are possible. |
952 |
|
|
If a rectangular board is specified, the first number specifies |
953 |
|
|
the number of columns, the second provides the number of rows. |
954 |
|
|
Square boards must not be defined using the compose type |
955 |
|
|
value: e.g. SZ[19:19] is illegal. |
956 |
|
|
The valid range for SZ is any size greater or equal to 1x1. |
957 |
|
|
For Go games the maximum size is limited to 52x52. |
958 |
|
|
Default value: game specific |
959 |
|
|
for Go: 19 (square board) |
960 |
|
|
for Chess: 8 (square board) |
961 |
|
|
Different board sizes may appear within a collection. |
962 |
|
|
See move-/point-type for more info. |
963 |
|
|
Related: FF, GM, ST, AP, CA |
964 |
|
|
|
965 |
|
|
Game info properties |
966 |
|
|
|
967 |
|
|
Property: AN |
968 |
|
|
Propvalue: simpletext |
969 |
|
|
Propertytype: game-info |
970 |
|
|
Function: Provides the name of the person, who made the annotations |
971 |
|
|
to the game. |
972 |
|
|
Related: US, SO, CP |
973 |
|
|
|
974 |
|
|
Property: BR |
975 |
|
|
Propvalue: simpletext |
976 |
|
|
Propertytype: game-info |
977 |
|
|
Function: Provides the rank of the black player. |
978 |
|
|
For Go (GM[1]) the following format is recommended: |
979 |
|
|
"..k" or "..kyu" for kyu ranks and |
980 |
|
|
"..d" or "..dan" for dan ranks. |
981 |
|
|
Go servers may want to add '?' for an uncertain rating and |
982 |
|
|
'*' for an established rating. |
983 |
|
|
Related: PB, BT, WR |
984 |
|
|
|
985 |
|
|
Property: BT |
986 |
|
|
Propvalue: simpletext |
987 |
|
|
Propertytype: game-info |
988 |
|
|
Function: Provides the name of the black team, if game was part of a |
989 |
|
|
team-match (e.g. China-Japan Supermatch). |
990 |
|
|
Related: PB, PW, WT |
991 |
|
|
|
992 |
|
|
Property: CP |
993 |
|
|
Propvalue: simpletext |
994 |
|
|
Propertytype: game-info |
995 |
|
|
Function: Any copyright information (e.g. for the annotations) should |
996 |
|
|
be included here. |
997 |
|
|
Related: US, SO, AN |
998 |
|
|
|
999 |
|
|
Property: DT |
1000 |
|
|
Propvalue: simpletext |
1001 |
|
|
Propertytype: game-info |
1002 |
|
|
Function: Provides the date when the game was played. |
1003 |
|
|
It is MANDATORY to use the ISO-standard format for DT. |
1004 |
|
|
Note: ISO format implies usage of the Gregorian calendar. |
1005 |
|
|
Syntax: |
1006 |
|
|
"YYYY-MM-DD" year (4 digits), month (2 digits), day (2 digits) |
1007 |
|
|
Do not use other separators such as "/", " ", "," or ".". |
1008 |
|
|
Partial dates are allowed: |
1009 |
|
|
"YYYY" - game was played in YYYY |
1010 |
|
|
"YYYY-MM" - game was played in YYYY, month MM |
1011 |
|
|
For games that last more than one day: separate other dates |
1012 |
|
|
by a comma (no spaces!); following shortcuts may be used: |
1013 |
|
|
"MM-DD" - if preceded by YYYY-MM-DD, YYYY-MM, MM-DD, MM or DD |
1014 |
|
|
"MM" - if preceded by YYYY-MM or MM |
1015 |
|
|
"DD" - if preceded by YYYY-MM-DD, MM-DD or DD |
1016 |
|
|
Shortcuts acquire the last preceding YYYY and MM (if |
1017 |
|
|
necessary). |
1018 |
|
|
Note: interpretation is done from left to right. |
1019 |
|
|
Examples: |
1020 |
|
|
1996-05,06 = played in May,June 1996 |
1021 |
|
|
1996-05-06,07,08 = played on 6th,7th,8th May 1996 |
1022 |
|
|
1996,1997 = played in 1996 and 1997 |
1023 |
|
|
1996-12-27,28,1997-01-03,04 = played on 27th,28th |
1024 |
|
|
of December 1996 and on 3rd,4th January 1997 |
1025 |
|
|
Note: it's recommended to use shortcuts whenever possible, |
1026 |
|
|
e.g. 1997-05-05,06 instead of 1997-05-05,1997-05-06 |
1027 |
|
|
Related: EV, RO, PC, RU, RE, TM |
1028 |
|
|
|
1029 |
|
|
Property: EV |
1030 |
|
|
Propvalue: simpletext |
1031 |
|
|
Propertytype: game-info |
1032 |
|
|
Function: Provides the name of the event (e.g. tournament). |
1033 |
|
|
Additional information (e.g. final, playoff, ..) |
1034 |
|
|
shouldn't be included (see RO). |
1035 |
|
|
Related: GC, RO, DT, PC, RU, RE, TM |
1036 |
|
|
|
1037 |
|
|
Property: GN |
1038 |
|
|
Propvalue: simpletext |
1039 |
|
|
Propertytype: game-info |
1040 |
|
|
Function: Provides a name for the game. The name is used to |
1041 |
|
|
easily find games within a collection. |
1042 |
|
|
The name should therefore contain some helpful information |
1043 |
|
|
for identifying the game. 'GameName' could also be used |
1044 |
|
|
as the file-name, if a collection is split into |
1045 |
|
|
single files. |
1046 |
|
|
Related: GC, EV, DT, PC, RO, ID |
1047 |
|
|
|
1048 |
|
|
Property: GC |
1049 |
|
|
Propvalue: text |
1050 |
|
|
Propertytype: game-info |
1051 |
|
|
Function: Provides some extra information about the following game. |
1052 |
|
|
The intend of GC is to provide some background information |
1053 |
|
|
and/or to summarize the game itself. |
1054 |
|
|
Related: GN, ON, AN, CP |
1055 |
|
|
|
1056 |
|
|
Property: ON |
1057 |
|
|
Propvalue: simpletext |
1058 |
|
|
Propertytype: game-info |
1059 |
|
|
Function: Provides some information about the opening played |
1060 |
|
|
(e.g. san-ren-sei, Chinese fuseki, etc.). |
1061 |
|
|
Related: GN, GC |
1062 |
|
|
|
1063 |
|
|
Property: OT |
1064 |
|
|
Propvalue: simpletext |
1065 |
|
|
Propertytype: game-info |
1066 |
|
|
Function: Describes the method used for overtime (byo-yomi). |
1067 |
|
|
Examples: "5 mins Japanese style, 1 move / min", |
1068 |
|
|
"25 moves / 10 min". |
1069 |
|
|
Related: TM, BL, WL, OB, OW |
1070 |
|
|
|
1071 |
|
|
Property: PB |
1072 |
|
|
Propvalue: simpletext |
1073 |
|
|
Propertytype: game-info |
1074 |
|
|
Function: Provides the name of the black player. |
1075 |
|
|
Related: PW, BT, WT |
1076 |
|
|
|
1077 |
|
|
Property: PC |
1078 |
|
|
Propvalue: simpletext |
1079 |
|
|
Propertytype: game-info |
1080 |
|
|
Function: Provides the place where the games was played. |
1081 |
|
|
Related: EV, DT, RO, RU, RE, TM |
1082 |
|
|
|
1083 |
|
|
Property: PW |
1084 |
|
|
Propvalue: simpletext |
1085 |
|
|
Propertytype: game-info |
1086 |
|
|
Function: Provides the name of the white player. |
1087 |
|
|
Related: PB, BT, WT |
1088 |
|
|
|
1089 |
|
|
Property: RE |
1090 |
|
|
Propvalue: simpletext |
1091 |
|
|
Propertytype: game-info |
1092 |
|
|
Function: Provides the result of the game. It is MANDATORY to use the |
1093 |
|
|
following format: |
1094 |
|
|
"0" (zero) or "Draw" for a draw (jigo), |
1095 |
|
|
"B+" ["score"] for a black win and |
1096 |
|
|
"W+" ["score"] for a white win |
1097 |
|
|
Score is optional (some games don't have a score e.g. chess). |
1098 |
|
|
If the score is given it has to be given as a real value, |
1099 |
|
|
e.g. "B+0.5", "W+64", "B+12.5" |
1100 |
|
|
Use "B+R" or "B+Resign" and "W+R" or "W+Resign" for a win by |
1101 |
|
|
resignation. Applications must not write "Black resigns". |
1102 |
|
|
Use "B+T" or "B+Time" and "W+T" or "W+Time" for a win on time, |
1103 |
|
|
"B+F" or "B+Forfeit" and "W+F" or "W+Forfeit" for a win by |
1104 |
|
|
forfeit, |
1105 |
|
|
"Void" for no result or suspended play and |
1106 |
|
|
"?" for an unknown result. |
1107 |
|
|
|
1108 |
|
|
Related: EV, DT, PC, RO, RU, TM |
1109 |
|
|
|
1110 |
|
|
Property: RO |
1111 |
|
|
Propvalue: simpletext |
1112 |
|
|
Propertytype: game-info |
1113 |
|
|
Function: Provides round-number and type of round. It should be |
1114 |
|
|
written in the following way: RO[xx (tt)], where xx is the |
1115 |
|
|
number of the round and (tt) the type: |
1116 |
|
|
final, playoff, league, ... |
1117 |
|
|
Related: EV, DT, PC, RU, RE, TM |
1118 |
|
|
|
1119 |
|
|
Property: RU |
1120 |
|
|
Propvalue: simpletext |
1121 |
|
|
Propertytype: game-info |
1122 |
|
|
Function: Provides the used rules for this game. |
1123 |
|
|
Because there are many different rules, SGF requires |
1124 |
|
|
mandatory names only for a small set of well known rule sets. |
1125 |
|
|
Note: it's beyond the scope of this specification to give an |
1126 |
|
|
exact specification of these rule sets. |
1127 |
|
|
Mandatory names for Go (GM[1]): |
1128 |
|
|
"AGA" (rules of the American Go Association) |
1129 |
|
|
"GOE" (the Ing rules of Goe) |
1130 |
|
|
"Japanese" (the Nihon-Kiin rule set) |
1131 |
|
|
"NZ" (New Zealand rules) |
1132 |
|
|
|
1133 |
|
|
Related: EV, DT, PC, RO, RE, TM |
1134 |
|
|
|
1135 |
|
|
Property: SO |
1136 |
|
|
Propvalue: simpletext |
1137 |
|
|
Propertytype: game-info |
1138 |
|
|
Function: Provides the name of the source (e.g. book, journal, ...). |
1139 |
|
|
Related: US, AN, CP |
1140 |
|
|
|
1141 |
|
|
Property: TM |
1142 |
elmex |
1.12 |
Propvalue: real |
1143 |
root |
1.1 |
Propertytype: game-info |
1144 |
|
|
Function: Provides the time limits of the game. |
1145 |
|
|
The time limit is given in seconds. |
1146 |
|
|
Related: EV, DT, PC, RO, RU, RE |
1147 |
|
|
|
1148 |
|
|
Property: US |
1149 |
|
|
Propvalue: simpletext |
1150 |
|
|
Propertytype: game-info |
1151 |
|
|
Function: Provides the name of the user (or program), who entered |
1152 |
|
|
the game. |
1153 |
|
|
Related: SO, AN, CP |
1154 |
|
|
|
1155 |
|
|
Property: WR |
1156 |
|
|
Propvalue: simpletext |
1157 |
|
|
Propertytype: game-info |
1158 |
|
|
Function: Provides the rank of the white player. For recommended |
1159 |
|
|
format see BR. |
1160 |
|
|
Related: PW, WT, BR |
1161 |
|
|
|
1162 |
|
|
Property: WT |
1163 |
|
|
Propvalue: simpletext |
1164 |
|
|
Propertytype: game-info |
1165 |
|
|
Function: Provide the name of the white team, if game was part of a |
1166 |
|
|
team-match (e.g. China-Japan Supermatch). |
1167 |
|
|
Related: PB, PW, BT |
1168 |
|
|
|
1169 |
|
|
Timing properties |
1170 |
|
|
|
1171 |
|
|
Property: BL |
1172 |
|
|
Propvalue: real |
1173 |
|
|
Propertytype: move |
1174 |
|
|
Function: Time left for black, after the move was made. |
1175 |
|
|
Value is given in seconds. |
1176 |
|
|
Related: TM, OT, WL, OB, OW |
1177 |
|
|
|
1178 |
|
|
Property: OB |
1179 |
|
|
Propvalue: number |
1180 |
|
|
Propertytype: move |
1181 |
|
|
Function: Number of black moves left (after the move of this node was |
1182 |
|
|
played) to play in this byo-yomi period. |
1183 |
|
|
Related: TM, OT, BL, WL, OW |
1184 |
|
|
|
1185 |
|
|
Property: OW |
1186 |
|
|
Propvalue: number |
1187 |
|
|
Propertytype: move |
1188 |
|
|
Function: Number of white moves left (after the move of this node was |
1189 |
|
|
played) to play in this byo-yomi period. |
1190 |
|
|
Related: TM, OT, BL, WL, OB |
1191 |
|
|
|
1192 |
|
|
Property: WL |
1193 |
|
|
Propvalue: real |
1194 |
|
|
Propertytype: move |
1195 |
|
|
Function: Time left for white after the move was made. |
1196 |
|
|
Value is given in seconds. |
1197 |
|
|
Related: TM, OT, BL, OB, OW |
1198 |
|
|
|
1199 |
|
|
Miscellaneous properties |
1200 |
|
|
|
1201 |
|
|
Property: FG |
1202 |
|
|
Propvalue: composed number SimpleText |
1203 |
|
|
Propertytype: - |
1204 |
|
|
Function: The figure property is used to divide a game into |
1205 |
|
|
different figures for printing: a new figure starts at the |
1206 |
|
|
node containing a figure property. |
1207 |
|
|
If the value is not empty then |
1208 |
|
|
- Simpletext provides a name for the diagram |
1209 |
|
|
- Number specifies some flags (for printing). |
1210 |
|
|
These flags are: |
1211 |
|
|
- coordinates on/off (value: 0/1) |
1212 |
|
|
- diagram name on/off (value: 0/2) |
1213 |
|
|
- list moves not shown in figure on/off (value: 0/4) |
1214 |
|
|
Some moves can't be shown in a diagram (e.g. ko |
1215 |
|
|
captures in Go) - these moves may be listed as text. |
1216 |
|
|
- remove captured stones on/off (value: 0/256) |
1217 |
|
|
'remove off' means: keep captured stones in the |
1218 |
|
|
diagram and don't overwrite stones played earlier - |
1219 |
|
|
this is the way diagrams are printed in books. |
1220 |
|
|
'remove on' means: capture and remove the stones from |
1221 |
|
|
the display - this is the usual viewer mode. |
1222 |
|
|
This flag is specific to Go (GM[1]). |
1223 |
|
|
- hoshi dots on/off (value: 0/512) |
1224 |
|
|
This flag is specific to Go (GM[1]). |
1225 |
|
|
- Ignore flags on/off (value: 32768) |
1226 |
|
|
If on, then all other flags should be ignored and |
1227 |
|
|
the application should use its own defaults. |
1228 |
|
|
The final number is calculated by summing up all flag values. |
1229 |
|
|
E.g. 515 = coordinates and diagram name off, remove captured |
1230 |
|
|
stones, list unshown moves, hoshi dots off; |
1231 |
|
|
257 = coordinates off, diagram name on, list unshown moves, |
1232 |
|
|
don't remove captured stones, hoshi dots on. |
1233 |
|
|
(this is how diagrams are printed in e.g. Go World) |
1234 |
|
|
Note: FG combined with VW, MN and PM are mighty tools to print |
1235 |
|
|
and compile diagrams. |
1236 |
|
|
Related: MN, PM, VW |
1237 |
|
|
|
1238 |
|
|
Property: PM |
1239 |
|
|
Propvalue: number |
1240 |
|
|
Propertytype: inherit |
1241 |
|
|
Function: This property is used for printing. |
1242 |
|
|
It specifies how move numbers should be printed. |
1243 |
|
|
0 ... don't print move numbers |
1244 |
|
|
1 ... print move numbers as they are |
1245 |
|
|
2 ... print 'modulo 100' move numbers |
1246 |
|
|
This mode is usually used in books or magazines. |
1247 |
|
|
Note: Only the first move number is calculated |
1248 |
|
|
'modulo 100' and the obtained number is increased |
1249 |
|
|
for each move in the diagram. |
1250 |
|
|
E.g. A figure containing moves |
1251 |
|
|
32-78 is printed as moves 32-78 |
1252 |
|
|
102-177 is printed as moves 2-77 |
1253 |
|
|
67-117 is printed as moves 67-117 |
1254 |
|
|
154-213 is printed as moves 54-113 |
1255 |
|
|
Default value: 1 |
1256 |
|
|
Related: MN, FG |
1257 |
|
|
|
1258 |
|
|
Property: VW |
1259 |
|
|
Propvalue: elist of point |
1260 |
|
|
Propertytype: inherit |
1261 |
|
|
Function: View only part of the board. The points listed are |
1262 |
|
|
visible, all other points are invisible. |
1263 |
|
|
Note: usually the point list is given in compressed |
1264 |
|
|
format (see 'point' type)! |
1265 |
|
|
Points have to be unique. |
1266 |
|
|
Have a look at the picture to get an idea. |
1267 |
|
|
VW[] clears any setting, i.e. the whole board is |
1268 |
|
|
visible again. |
1269 |
|
|
Related: DD, PM, FG |
1270 |
|
|
|
1271 |
|
|
Go properties |
1272 |
|
|
Restrictions: TW and TB points must be unique, i.e. it's illegal to list the same point in TB and TW within the same node. |
1273 |
|
|
Gametype: 1 |
1274 |
|
|
|
1275 |
|
|
Property: HA |
1276 |
|
|
Propvalue: number |
1277 |
|
|
Propertytype: game-info |
1278 |
|
|
Function: Defines the number of handicap stones (>=2). |
1279 |
|
|
If there is a handicap, the position should be set up with |
1280 |
|
|
AB within the same node. |
1281 |
|
|
HA itself doesn't add any stones to the board, nor does |
1282 |
|
|
it imply any particular way of placing the handicap stones. |
1283 |
|
|
Related: KM, RE, RU |
1284 |
|
|
|
1285 |
|
|
Property: KM |
1286 |
|
|
Propvalue: real |
1287 |
|
|
Propertytype: game-info |
1288 |
|
|
Function: Defines the komi. |
1289 |
|
|
Related: HA, RE, RU |
1290 |
|
|
|
1291 |
|
|
Property: TB |
1292 |
|
|
Propvalue: elist of point |
1293 |
|
|
Propertytype: - |
1294 |
|
|
Function: Specifies the black territory or area (depends on |
1295 |
|
|
rule set used). |
1296 |
|
|
Points must be unique. |
1297 |
|
|
Related: TW |
1298 |
|
|
|
1299 |
|
|
Property: TW |
1300 |
|
|
Propvalue: elist of point |
1301 |
|
|
Propertytype: - |
1302 |
|
|
Function: Specifies the white territory or area (depends on |
1303 |
|
|
rule set used). |
1304 |
|
|
Points must be unique. |
1305 |
|
|
Related: TB |
1306 |
|
|
|
1307 |
|
|
Octi properties |
1308 |
|
|
Gametype: 19 |
1309 |
|
|
|
1310 |
|
|
Property: RU (rules) |
1311 |
|
|
Propvalue: simpletext |
1312 |
|
|
Propertytype: game-info |
1313 |
|
|
Function: Valid values are one major variation ("full", "fast", |
1314 |
|
|
or "kids") followed by a colon and a comma separated |
1315 |
|
|
elist of variations ("edgeless", "superprong", etc.). |
1316 |
|
|
|
1317 |
|
|
The colon may be omitted if either side is empty. |
1318 |
|
|
The default is 2-player full, no variations. |
1319 |
|
|
The 4-player game is not currently available. |
1320 |
|
|
|
1321 |
|
|
Property: BO (black octisquares) |
1322 |
|
|
Propvalue: list of point |
1323 |
|
|
Propertytype: game-info |
1324 |
|
|
Function: The position of Black's octi squares. Black will be |
1325 |
|
|
setup with one empty pod on each of these points. |
1326 |
|
|
It is illegal to list the same point twice. |
1327 |
|
|
Traditionally, Black sits at the south end of the board. |
1328 |
|
|
Related: WO |
1329 |
|
|
|
1330 |
|
|
Property: WO (white octisquares) |
1331 |
|
|
Propvalue: list of point |
1332 |
|
|
Propertytype: game-info |
1333 |
|
|
Function: The position of White's octi squares. White will be |
1334 |
|
|
setup with one empty pod on each of these points. |
1335 |
|
|
It is illegal to list the same point twice. |
1336 |
|
|
Traditionally, White sits at the north end of the board. |
1337 |
|
|
Related: BO |
1338 |
|
|
|
1339 |
|
|
Property: NP (number of prongs) |
1340 |
|
|
Propvalue: number |
1341 |
|
|
Propertytype: game-info |
1342 |
|
|
Function: This is the number of prongs each players has at the |
1343 |
|
|
start of the game. |
1344 |
|
|
The default will be derived from the rules. |
1345 |
|
|
Related: NR |
1346 |
|
|
|
1347 |
|
|
Property: NR (number of reserve) |
1348 |
|
|
Propvalue: number |
1349 |
|
|
Propertytype: game-info |
1350 |
|
|
Function: This is the number of pods in each players reserve at |
1351 |
|
|
the start of the game. |
1352 |
|
|
The default will be derived from the rules. |
1353 |
|
|
Related: NP, NS |
1354 |
|
|
|
1355 |
|
|
Property: NS (number of superprongs) |
1356 |
|
|
Propvalue: number |
1357 |
|
|
Propertytype: game-info |
1358 |
|
|
Function: This is the number of superprongs each players has at |
1359 |
|
|
the start of the game. |
1360 |
|
|
The default will be derived from the rules. |
1361 |
|
|
Related: NR |
1362 |
|
|
|
1363 |
|
|
Property: AS (arrow stone) |
1364 |
|
|
Propvalue: list of composed stone ':' point |
1365 |
|
|
Propertytype: - |
1366 |
|
|
Function: Most of the same restriction from AR apply. |
1367 |
|
|
The same arrow must not occur twice; however, two arrows |
1368 |
|
|
from different stones at the same point may have arrows |
1369 |
|
|
to the same destination. Single point arrows are also |
1370 |
|
|
illegal. |
1371 |
|
|
Related: AR |
1372 |
|
|
|
1373 |
|
|
Property: CS (circle stone) |
1374 |
|
|
Propvalue: list of stone |
1375 |
|
|
Propertytype: - |
1376 |
|
|
Function: Marks the given stones, each with a circle. |
1377 |
|
|
Related: CR |
1378 |
|
|
|
1379 |
|
|
Property: MS (mark stone) |
1380 |
|
|
Propvalue: list of stone |
1381 |
|
|
Propertytype: - |
1382 |
|
|
Function: Marks the given stones, each with an ex. |
1383 |
|
|
Related: MA |
1384 |
|
|
|
1385 |
|
|
Property: SS (square stone) |
1386 |
|
|
Propvalue: list of stone |
1387 |
|
|
Propertytype: - |
1388 |
|
|
Function: Marks the given stones, each with a square. |
1389 |
|
|
Related: SQ |
1390 |
|
|
|
1391 |
|
|
Property: TS (triangle stone) |
1392 |
|
|
Propvalue: list of stone |
1393 |
|
|
Propertytype: - |
1394 |
|
|
Function: Marks the given stones, each with a triangle. |
1395 |
|
|
Related: TR |
1396 |
|
|
|
1397 |
|
|
Property: RP (remove pod) |
1398 |
|
|
Propvalue: list of stone |
1399 |
|
|
Propertytype: setup |
1400 |
|
|
Function: Removes a stone from the board. |
1401 |
|
|
More selective than AddEmpty. |
1402 |
|
|
Related: AE |
1403 |
|
|
|
1404 |
|
|
Backgammon properties |
1405 |
|
|
Gametype: 6 |
1406 |
|
|
|
1407 |
|
|
Property: CO |
1408 |
|
|
Propvalue: simpletext |
1409 |
|
|
Propertytype: setup |
1410 |
|
|
Function: Set the position of the doubling cube. The value |
1411 |
|
|
should be `b' (black), `w' (white), `c' (centred), or `n' |
1412 |
|
|
(none -- for cubeless or Crawford games). |
1413 |
|
|
Related: CV |
1414 |
|
|
|
1415 |
|
|
Property: CV |
1416 |
|
|
Propvalue: number |
1417 |
|
|
Propertytype: setup |
1418 |
|
|
Function: Set the value of the doubling cube. This value |
1419 |
|
|
defaults to 1 at the beginning of the game, but a CV property |
1420 |
|
|
should be added when setting up a position where a double has |
1421 |
|
|
been made, or at the beginning of a money game if automatic |
1422 |
|
|
doubles occur. |
1423 |
|
|
Related: CP |
1424 |
|
|
|
1425 |
|
|
Property: DI |
1426 |
|
|
Propvalue: number |
1427 |
|
|
Propertytype: setup |
1428 |
|
|
Function: Set the dice without moving (this could be useful for |
1429 |
|
|
creating problem positions, e.g. DI[31]) |
1430 |
|
|
Related: CO |
1431 |
|
|
|
1432 |
|
|
Property: MI |
1433 |
|
|
Propvalue: list of composed simpletext ':' simpletext |
1434 |
|
|
Propertytype: game-info |
1435 |
|
|
Function: Specifies information about the match the game belongs to. |
1436 |
|
|
This property should specify a list of tag/value pairs, where |
1437 |
|
|
the allowable tags are case-insensitive, and include: |
1438 |
|
|
|
1439 |
|
|
length - the match length (number of points); value should |
1440 |
|
|
be a number |
1441 |
|
|
game - the number of this game within the match (the |
1442 |
|
|
first game is 1); value should be a number |
1443 |
|
|
bs - the score for Black at the start of the game; |
1444 |
|
|
value should be a number |
1445 |
|
|
ws - the score for White at the start of the game; |
1446 |
|
|
value should be a number |
1447 |
|
|
|
1448 |
|
|
Unknown tags should be ignored (a warning may be produced). |
1449 |
|
|
The order of tags in the list is not significant. An example |
1450 |
|
|
MI property is: |
1451 |
|
|
MI[length:7][game:3][ws:2][bs:1] |
1452 |
|
|
Related: EV, GN, RE, RO |
1453 |
|
|
|
1454 |
|
|
Property: RE |
1455 |
|
|
Propvalue: simpletext |
1456 |
|
|
Propertytype: game-info |
1457 |
|
|
Function: The general RE property has the following |
1458 |
|
|
modification in backgammon games: in the case of a |
1459 |
|
|
resignation, the value should also specify the number of |
1460 |
|
|
points before the R(esign). Here are three example RE |
1461 |
|
|
properties: |
1462 |
|
|
|
1463 |
|
|
RE[B+6R] -- White resigns a backgammon on a 2 |
1464 |
|
|
cube (worth 6 points). |
1465 |
|
|
RE[W+2Resign] -- Black resigns a gammon on a 1 cube |
1466 |
|
|
(worth 2 points). |
1467 |
|
|
RE[W+4] -- Black drops a redouble to 8 (note |
1468 |
|
|
this is considered a normal loss, not |
1469 |
|
|
a resignation). |
1470 |
|
|
Related: RE |
1471 |
|
|
|
1472 |
|
|
Property: RU |
1473 |
|
|
Propvalue: simpletext |
1474 |
|
|
Propertytype: game-info |
1475 |
|
|
Function: Backgammon-specific values for the general RU property |
1476 |
|
|
include the following: |
1477 |
|
|
|
1478 |
|
|
[Crawford] -- the Crawford rule is being used in this match, |
1479 |
|
|
although this is not the Crawford game. |
1480 |
|
|
[Crawford:CrawfordGame] -- this IS the Crawford game. |
1481 |
|
|
[Jacoby] -- the Jacoby rule is in use for this game. |
1482 |
|
|
Related: RU |
1483 |
|
|
|
1484 |
|
|
Lines of Action properties |
1485 |
|
|
Gametype: 9 |
1486 |
|
|
|
1487 |
|
|
Property: AS |
1488 |
|
|
Propvalue: SimpleText |
1489 |
|
|
Propertytype: - |
1490 |
|
|
Function: Adding stones - the color of the player who is adding |
1491 |
|
|
stones to the board. The valid strings are 'Black', 'White' |
1492 |
|
|
or 'None'. The puropse of this property is to define a |
1493 |
|
|
board position where the human is expected to continue placing |
1494 |
|
|
stones on the board through some user interface. |
1495 |
|
|
|
1496 |
|
|
Property: IP |
1497 |
|
|
Propvalue: SimpleText |
1498 |
|
|
Propertytype: game-info |
1499 |
|
|
Function: Designates the initial position in the game to be |
1500 |
|
|
displayed by the viewer. |
1501 |
|
|
The only value currently supported is 'End', which causes |
1502 |
|
|
the viewer to initially display the final position of the game. |
1503 |
|
|
The default is to display the position after setup but before |
1504 |
|
|
any moves. |
1505 |
|
|
|
1506 |
|
|
Property: IY |
1507 |
|
|
Propvalue: SimpleText |
1508 |
|
|
Propertytype: game-info |
1509 |
|
|
Function: Invert Y axis. Values are 'true' or 'false'. |
1510 |
|
|
If 'true', the board should be displayed with numbers |
1511 |
|
|
increasing in value from bottom to top of the screen. |
1512 |
|
|
Default: 'false' |
1513 |
|
|
|
1514 |
|
|
Property: SE |
1515 |
|
|
Propvalue: point |
1516 |
|
|
Propertytype: - |
1517 |
|
|
Function: Mark the given point and up to 8 additional points, |
1518 |
|
|
depending on where the provided point (stone) could legally |
1519 |
|
|
move. |
1520 |
|
|
|
1521 |
|
|
Property: SU |
1522 |
|
|
Propvalue: SimpleText |
1523 |
|
|
Propertytype: game-info |
1524 |
|
|
Function: Setup type - designates the intial placement of pieces, |
1525 |
|
|
and also the implicitly the variation on the basic rules to be |
1526 |
|
|
employed. The currently valid values include the following |
1527 |
|
|
strings: |
1528 |
|
|
'Standard', 'Scrambled-eggs', 'Parachute', 'Gemma' and 'Custom' |
1529 |
|
|
(the initial board is empty, AB and AW properties |
1530 |
|
|
will be used to establish the starting position). |
1531 |
|
|
Default: 'Standard' |
1532 |
|
|
For details on the setups and rule variations, consult the |
1533 |
|
|
LOA home pages. |
1534 |
|
|
|
1535 |
|
|
Hex properties |
1536 |
|
|
Gametype: 11 |
1537 |
|
|
|
1538 |
|
|
Property: IS |
1539 |
|
|
Propvalue: list of composed SimpleText ':' SimpleText |
1540 |
|
|
Propertytype: root |
1541 |
|
|
Function: This property allows applications to store and read |
1542 |
|
|
an initial viewer setting. The property value is a list of |
1543 |
|
|
"keyword followed by ':' followed by either 'on' or 'off'". |
1544 |
|
|
Valid keywords are: |
1545 |
|
|
'tried' - identify future moves that have been tried? |
1546 |
|
|
'marked' - show good/bad move markings? |
1547 |
|
|
'lastmove' - identify the last cell played? |
1548 |
|
|
'headings' - display column/row headings (a b.., 1 2..)? |
1549 |
|
|
'lock' - lock the game against new moves (for analysis)? |
1550 |
|
|
This property is allowed in the root node only. |
1551 |
|
|
Example: IS[tried:on][lock:off][marked:off] |
1552 |
|
|
|
1553 |
|
|
Property: IP |
1554 |
|
|
Propvalue: SimpleText |
1555 |
|
|
Propertytype: game-info |
1556 |
|
|
Function: Designates the initial position that the viewer |
1557 |
|
|
should display. It will most frequently indicate the |
1558 |
|
|
current position of play in the game. This is necessary |
1559 |
|
|
because future possible moves may have been explored, |
1560 |
|
|
and the user must be able to distinguish real moves |
1561 |
|
|
actually made from exploratory moves. More than one IP[] |
1562 |
|
|
property in a game is illegal, and the behaviour undefined. |
1563 |
|
|
The property value should be empty (""); it is specified |
1564 |
|
|
as SimpleText for compatibility. |
1565 |
|
|
|
1566 |
|
|
Amazons properties |
1567 |
|
|
Gametype: 18 |
1568 |
|
|
|
1569 |
|
|
Property: AA |
1570 |
|
|
Propvalue: list of point |
1571 |
|
|
Propertytype: setup |
1572 |
|
|
Function: Adding arrows to the board. This can be used to set up |
1573 |
|
|
positions or problems. |
1574 |
|
|
|
1575 |
|
|
End: this marks the end |
1576 |
|
|
|