Games::SGF::Go::Rotator - subclass of Games::SGF::Go that can rotate the board
If you have an SGF file of a game that your opponent recorded, it will be the wrong way up from your perspective, and so harder for you to remember what's going on when you analyse the game later. This subclass of Games::SGF::Go provides extra methods for rotating it.
my $sgf = Games::SGF::Go::Rotator->new(); $sgf->readFile('mygame.sgf'); $sgf->rotate(); # rotate by 180 degrees, what you'd normally want $sgf->rotate90(); # rotate 90 degrees clockwise.
In addition to the methods documented below, all of Games::SGF::Go's methods are, of course, also available. Neither of the new methods take any arguments, and they return the rotated SGF as well as altering it in-place, for convenience when chaining methods.
Rotate the SGF through 180 degrees.
Rotate the SGF through 90 degrees clockwise.
I welcome feedback about my code, including constructive criticism. Bug reports should be made using http://rt.cpan.org/ or by email, and should include the smallest possible chunk of code, along with any necessary data, which demonstrates the bug. Ideally, this will be in the form of a file which I can drop in to the module's test suite.
Rotating a game will probably reset the pointer used when navigating around the file. This doesn't matter to me. If it matters to you, then please submit a patch with tests.
If you have multiple games in a single file, it will probably screw up. Again, I don't care. If you care, then please submit a patch with tests.
Games::SGF::Go
Daniel Gilder for pointing out the bug where stuff like AE[aa:ee] wasn't being rotated, and providing a fix.
David Cantrell <david@cantrell.org.uk>
Copyright 2010 David Cantrell <david@cantrell.org.uk>
This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
This module is also free-as-in-mason software.
To install Games::SGF::Go::Rotator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::SGF::Go::Rotator
CPAN shell
perl -MCPAN -e shell install Games::SGF::Go::Rotator
For more information on module installation, please visit the detailed CPAN module installation guide.