NAME
Games::Chess::Coverage - Expose the potential energy of chess games
SYNOPSIS
use Games::Chess::Coverage;
$g = Games::Chess::Coverage->new;
$g = Games::Chess::Coverage->new( fen => $fen_string );
$g = Games::Chess::Coverage->new( game => $games_chess_object );
$g = Games::Chess::Coverage->new( pgn => $pgn );
for my $game ( 1 .. $g->number_of_games ) {
for my $ply ( 0 .. $g->number_of_ply( $game ) ) {
$g->build_game( $game, $ply );
# Do something interesting like visualize with $g->pieces
# and $g->states...
}
}
DESCRIPTION
A Games::Chess::Coverage object represents a chess game in terms of move and capture state.
A piece's coverage extends within its limit of mobility or until a collision occurs with another piece. This includes the many special considerations that are part of chess like en passant capture and the fact that a king can't move into check, etc.
In my mind this module:
Is a chess analysis laboratory
Measures potential energy
Represents tension as a landscape
Shows footprint interference patterns and trends
Delineates power stuggle
Looks cool when visualized :-)
Note: This is not a chess playing module. It simply returns the state of a chess game at a particular moment. If you want to know what the coverage might be in say five ply, you must either have the PGN or generate that slice of the game (in real-time, for instance :).
PUBLIC METHODS
new
$g = Games::Chess::Coverage->new( %attributes );
Create a new Games::Chess::Coverage object based on the following attributes:
Key Default ________________ verbose => 0 fen => rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 game => new Games::Chess::Position number_of_games => 1 number_of_ply => 0
Calling the constructor with no arguments creates a single game with the traditional starting board position.
pieces
$pieces = $g->pieces;
This method returns a hash reference of the game coverage object's
Games::Chess::Piece
's keyed by their location.states
$states = $g->states;
This method returns a hash reference of board location states.
A state in the context of this module is ...
number_of_games
$n = $g->number_of_games;
Return the number of games in the provided PGN.
number_of_ply
$p = $g->number_of_ply; $p = $g->number_of_ply( $n );
Return the number of ply (twice the number of moves) in a given game from the object's PGN. If a game number is not provided, the current object
game_number
attribute is used.warp_spacetime
$g->warp_spacetime( $manifold );
Warp local space-time.
EXAMPLES
Coming soon to a theatre near you...
Until then, take a look at the eg directory in this distribution.
TO DO
Remove the dependence upon Games::Chess
.
Abstract the cell updating method so that smoother inheritance can happen.
Document the API extensibility by showing how "user defined" piece move/capture constraint callbacks may be created.
Make this tiny and fast with bit vector matrix calculations?
SEE ALSO
This is a great site:
http://www.chessclub.demon.co.uk/tutorial/beginner/intro/intro.htm
Of course there is also
http://mathworld.wolfram.com/Chess.html
This is a related (possibly mathematically equivalent) concept:
http://www.users.globalnet.co.uk/~perry/maths/chessgraph/chessgraph.htm
Here is a chess glossary with many analysis terms:
http://www.jeremysilman.com/chess_glossary/glossary_chess_terms_a.html
What document on visualization would be complete without references to Edward R. Tufte?
http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=00013l&topic_id=1&topic=Ask%20E%2eT%2e
and http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0000Mn&topic_id=1&topic=Ask%20E%2eT%2e
And what chess module about analysis would be complete without a reference to the Canon of educational chess games?
http://www.ex.ac.uk/~dregis/DR/Canon/canonidx.html
DEDICATION
My chess playing Brother, Aaron. Hi Aaron. :-)
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2004, Gene Boggs
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.