NAME

Games::AlphaBeta::Reversi - Reversi position class for use with Games::AlphaBeta

SYNOPSIS

package My::Reversi;
use base Games::AlphaBeta::Reversi;

# implement drawing routine
sub draw { ... }

package main;
use My::Reversi;
use Games::AlphaBeta;

my ($p, $g);
$p = My::Reversi->new;
$g = Games::AlphaBeta->new($p);

while ($g->abmove) {
    $p->draw;
}

DESCRIPTION

This module implements a position-object suitable for use with Games::AlphaBeta. It inherits from the Games::AlphaBeta::Position base class, so be sure to read its documentation. The methods implemented there will not be described here.

METHODS

_init()

Internal method.

Initialize the initial state. Call SUPER::_init(@_) to do part of the work.

as_string

Return a plain-text representation of the current game position as a string.

findmoves

Return an array of all legal moves at the current position (for the current player).

evaluate

Evaluate a game position.

endpos

Return true if the current position is an end position, or undef otherwise.

apply $move

Apply a move to the current position, producing the new position. Return reference to itself on succes, undef on error.

BUGS

The findmoves() method is too slow. This method is critical to performance when running under Games::AlphaBeta, as more than 60% of the execution time is spent there (when searching to ply 3). Both the evaluate() and endpos() routines use findmoves() internally, so by speeding this routine up we could gain a lot of speed.

SEE ALSO

The author's website, describing this and other projects: http://brautaset.org/projects/

AUTHOR

Stig Brautaset, <stig@brautaset.org>

COPYRIGHT AND LICENCE

Copyright (C) 2004 by Stig Brautaset

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.3 or, at your option, any later version of Perl 5 you may have available.