ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Games-Go-SGF-Grove/Grove.pm
Revision: 1.4
Committed: Sun Jul 20 22:16:14 2008 UTC (15 years, 11 months ago) by root
Branch: MAIN
Changes since 1.3: +183 -46 lines
Log Message:
*** empty log message ***

File Contents

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