David Whitcomb > Games-SGF > Games::SGF::Go

Download:
Games-SGF-0.993.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.993   Source  

NAME ^

Games::SGF::Go - A Go Specific SGF Parser

VERSION ^

Version 0.993

SYNOPSIS ^

  use Games::SGF::Go;

  my $sgf = new Games::SGF::Go;

  $sgf->readFile('somegame.sgf');

  # fetch Properties
  my $komi = $sgf->property('KM');
  my $handicap = $sgf->property('HA');

  # move to next node
  $sgf->next;

  # get a move
  my $move = $sgf->property('B');
  
  # add it to a board
  
  $board[ $move->[0] ][ $move->[1] ] = 'B';

DISCRIPTION ^

Games::SGF::Go Extends Games::SGF for the game specifics of Go. These include adding the tags 'TB', 'TW', 'HA', and 'KM'. It will also parse and check the stone, move, and point types.

The stone, move and point types will be returned as an array ref containing the position on the board.

You can set application specific tags using "setTag" in Games::SGF. All the callbacks to Games::SGF have been set and thus can't be reset.

All other methods from "METHODS" in Games::SGF can be used as you normally would.

METHODS ^

new

  my $sgf = new Games::SGF::Go;

This will create the Games::SGF::Go object.

point

stone

move

  $struct = $self->move(@cord);
  @cord = $self->move($struct);

If a point, stone, or move is passed in, it will be broken into it's parts and returned. If the parts are passed in it will construct the internal structure which the parser uses.

These override "point" in Games::SGF, "stone" in Games::SGF, and "move" in Games::SGF.

isPass

   $sgf->isPass($move);

The method will return true if the move was a pass.

This is represented in the SGF as an empty string:

  ;B[];W[]

pass

   $move = $sgf->pass;

This will return a $move which is a pass.

ALSO SEE ^

Games::SGF

http://www.red-bean.com/sgf/go.html

AUTHOR ^

David Whitcomb, <whitcode at gmail.com>

BUGS ^

Please report any bugs or feature requests to bug-games-sgf at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-SGF. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Games::SGF::Go

You can also look for information at:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2008 David Whitcomb, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .

syntax highlighting: