This module allows to play a chess game using STDIN or the xboard graphical interface.
Il also can calculate legal moves and uses the Alpha-Beta search algorithm to find the best move.
METHODS
* $cp = Chess::Play->new()
Create a new object to play chess.
* $cp->reset()
Reset to the start position.
* $cp->set_piece_val($p_val, $n_val, $b_val, $r_val, $q_val)
Change default values for pieces (the defaults are : 1, 3, 3, 5, 9)
* $cp->set_depth($depth)
Set the depth of the search algorithm (Alpha-Beta search).
* $cp->legal_moves()
Calculate the list of legal moves
* $cp->do_move($move)
execute a move (for instance "e2e4" or "a7a8q")
* $cp->game_over()
Tell if the game is over (Sheckmate, Stalemate, Insufficient Material, 50 moves rule). Threeway repetition is not supported in this version.
* $cp->best_move()
Return the best move according to the search algorithm
Play a chess game using xboard (only the basic xboad directives are supported). You can choose a name for your engine.
Examples:
my $cp = Chess::Play->new();
Execute some moves
$cp->do_move("e2e4");
$cp->do_move("e7e5");
Calculating legal moves
my @legal_moves = $cp->legal_moves()
Play a chess game using stdin
$cp->reset();
$ce->set_depth(2);
$ce->play();
Play a chess game using xboard
$cp->reset();
$ce->set_depth(2);
$cp->xboard_play("My_Chess_Engine")
xboard -fcp /path/to/my_engine.pl or xboard -fcp /path/to/my_engine.pl -scp /path/to/my_engine2.pl
AUTHOR
Giuliano Ippoliti, g1ul14n0 AT gmail
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
COPYRIGHT AND LICENCE
This is free software in the colloquial nice-guy sense of the word.
Copyright (c) 2009, Giuliano Ippoliti. You may redistribute and/or modify
it under the same terms as Perl itself.