Why not adopt me?
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 ($p = $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()
-
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 [$own_call]
-
Return an array of all legal moves at the current position for the current player.
If $own_call is true, we have been recursively called by ourself to find out if the other player could move. If neither player can move, return undef to denote this as an ending position. Otherwise return a pass move.
- evaluate
-
Evaluate a game position.
- 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.