Dave's Free Press

Technology: Games-SGF-Go-Rotator-1.21

 

Older stuff

Games::SGF::Go::Rotator - subclass of Games::SGF::Go that can rotate the board


NAME

Games::SGF::Go::Rotator - subclass of Games::SGF::Go that can rotate the board


DESCRIPTION

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.


SYNOPSIS

  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.


METHODS

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

Rotate the SGF through 180 degrees.

rotate90

Rotate the SGF through 90 degrees clockwise.


BUGS and FEEDBACK

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.


SEE ALSO

Games::SGF::Go


THANKS TO ...

Daniel Gilder for pointing out the bug where stuff like AE[aa:ee] wasn't being rotated, and providing a fix.


AUTHOR, COPYRIGHT and LICENCE

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.


CONSPIRACY

This module is also free-as-in-mason software.