ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Games-Go-SGF-Grove/Grove.pm
Revision: 1.16
Committed: Mon Jul 21 19:51:44 2008 UTC (16 years, 4 months ago) by root
Branch: MAIN
CVS Tags: rel-0_1
Changes since 1.15: +15 -1 lines
Log Message:
*** empty log message ***

File Contents

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