Games::Go::Sgf2Dg::Dg2SL(3pm) | User Contributed Perl Documentation | Games::Go::Sgf2Dg::Dg2SL(3pm) |
Games::Go::Sgf2Dg::Dg2SL - Perl extension to convert Games::Go::Sgf2Dg::Diagrams to Sensei's Library format
use Games::Go::Sgf2Dg::Dg2SL
my $dg2sl = B<Games::Go::Sgf2Dg::Dg2SL-E<gt>new> (options); my $sl = $dg2sl->convertDiagram($diagram);
A Games::Go::Sgf2Dg::Dg2SL object converts a Games::Go::Sgf2Dg::Diagram object into Sensei's Library diagrams (see http://senseis.xmp.net/).
Sensei's Library diagrams only support move numbers from 1-10, so make sure you call sgf2dg with arguments that specify a maximum of 10 moves per diagram and starting each diagram with move number 1. Example:
sgf2dg -converter SL -m 10 -n foo.sgf
Sensei's Library also doesn't support labelled stones.
An initial setup diagram is printed if the initial board isn't empty and doesn't have a handicap setup - i.e., only black stones, all of which are on hoshi points.
Diagrams' extents are limited to the stones actually played, plus a margin. That is, if there are only stones in one corner, only that corner is printed, not the whole diagram. This is useful for analyses of local positions, but if the first ten moves of a real game are all in one corner - however unlikely that may be -, it would produce undesirable results.
A new Games::Go::Sgf2Dg::Dg2SL takes the following options:
Default: 19
Default: false
Default:
sub { my ($x, $y) = @_;
$x = chr($x - 1 + ord('a')); # convert 1 to 'a',
etc
$y = chr($y - 1 + ord('a'));
return "$x$y"; }, # concatenate two letters
See also the diaCoords method below.
Default: undef
my $int = $diagram->get($dg2mp->diaCoords(3, 4));
Returns the converted text.
Both long and short property names are recognized, and all unrecognized properties are ignored with no warnings. Note that these properties are all intended as game-level notations.
Seems likely.
Marcel Gruenauer, <marcel@cpan.org<gt>
Copyright (C) 2007 by Marcel Gruenauer.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
2019-10-27 | perl v5.30.0 |