Chess::Rep

Represent chess positions, generate list of legal moves, parse moves in various formats.
Download

Chess::Rep Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mihai Bazon
  • Publisher web site:
  • http://search.cpan.org/~mishoo/DBIx-OO-v0.0.4/lib/DBIx/OO.pm

Chess::Rep Tags


Chess::Rep Description

Represent chess positions, generate list of legal moves, parse moves in various formats. Chess::Rep is a Perl module that represent chess positions, generate list of legal moves, parse moves in various formats.The name stands for "Chess Representation", basically meaning that this module won't actually play chess -- it just helps you represent the board and validate the moves according to the laws of chess. It also generates a set of all valid moves for the color to play.SYNOPSIS my $pos = Chess::Rep->new; print $pos->get_fen; # use any decent notation to describe moves # the parser will read pretty much anything which isn't ambiguous $pos->go_move('e4'); $pos->go_move('e7e5'); $pos->go_move('Bc4'); $pos->go_move('Nc8-C6'); $pos->go_move('Qf3'); $pos->go_move('d6'); $pos->go_move('F3-F7'); if ($pos->status->{check}) { print("CHECK "); } if ($pos->status->{mate}) { print("MATE "); } if ($pos->status->{stalemate}) { print("STALEMATE "); } # reset position from FEN $pos->set_from_fen('r1b1k1nr/pp1ppppp/8/2pP4/3b4/8/PPP1PqPP/RNBQKBNR w KQkq - 0 1'); my $status = $pos->status; my $moves = $status->{moves}; # there's only one move, E1-D2 print Chess::Rep::get_field_id($moves->{from}) . '-' . Chess::Rep::get_field_id($moves->{to}); print $status->{check}; # 1 print $status->{mate}; print $status->{stalemate}; Requirements: · Perl


Chess::Rep Related Software