Chess::Game

Chess::Game is a class to record and validate the moves of a game of chess.
Download

Chess::Game Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Brian Richardson
  • Publisher web site:
  • http://search.cpan.org/~bjr/Chess-0.6.0/lib/Chess/Game/MoveList.pm

Chess::Game Tags


Chess::Game Description

Chess::Game is a class to record and validate the moves of a game of chess. Chess::Game is a class to record and validate the moves of a game of chess.SYNOPSIS use Chess::Game; $game = Chess::Game->new(); $clone = $game->clone(); $move = $game->make_move("e2", "e4"); $move_c = $clone->make_move("e2", "e4"); $true = ($move->get_piece() ne $move_c->get_piece()); $move = $game->delete_move(); ... while (!defined($result = $game->result())) { # get a move $move = $game->make_move($sq1, $sq2); if (!defined($move)) { print $game->get_message(); } } if ($result == 1) { print "White wins!n"; } elsif ($result == 0) { print "Draw!n" } else { print "Black wins!n"; }The Chess module provides a framework for writing chess programs with Perl. This class forms part of that framework, providing move validation for all moves recorded using the Chess::Game class. The Game contains a Chess::Board, 32 Chess::Pieces and a Chess::Game::MoveList that contains a series of Chess::Game::MoveListEntrys that record the exact state of the game as it progresses. Moves can be taken back one-at-a-time to allow for simple movelist manipulation. Requirements: · Perl


Chess::Game Related Software