NAME
Chess::Rep::Coverage::Imager - Expose chess ply potential energy with Imager
SYNOPSIS
use Chess::Rep::Coverage::Imager;
my $g = Chess::Rep::Coverage::Imager->new();
$g->write('board', 'png');
$g->set_from_fen('8/8/8/3pr3/4P3/8/8/8 w ---- - 0 1');
$g->coverage(); # Recalculate coverage status
$g->board(); # Re-render the board.
$g->write('foo', 'png');
DESCRIPTION
This module exposes the "potential energy" of a chess ply by writing an Imager graphic of the board positions, pieces and their "attack or protection status."
METHODS
new()
Return a new Chess::Coverage::Imager object.
write($name, $type_extension)
$filename = $g->write('my-board', 'png');
Return filename on success (as defined by siple existance) or undef on failure.
board()
$board = $g->board(%arguments);
Return an Imager board layout with threats and protections indicated by concentric colored circles. Move status is indicated by concentric colored squares.
These are the %arguments with their default values, that you can override in the call:
border => 2
channels => 4
font_file => undef # Set as /path/to/a/fontfile.ttf
font_size => 15
grid => 1 # Boolean
letters => 1 # Boolean
max_coord => 7 # Board side - 1
margin => 20
square_height => 33
square_width => 33
board_color => #FFFFFF # white
border_color => #808080 # gray
grid_color => #C0C0C0 # silver
letter_color => #000000 # black
white_move_color => #00FF00 # lime
black_move_color => #FDD017 # gold
white_threat_color => #00FF00 # lime
black_threat_color => #FDD017 # gold
white_protect_color => #00FF00 # lime
black_protect_color => #FDD017 # gold
For instance, if you just want to see the white player protection as lime green and threats from the black player as red, call board() with white_move_color, black_move_color, white_threat_color, and black_protect_color all as #FFFFFF, the black_threat_color = '#FF0000'> and white_protect_color = 00FF00>.
The FEN sequence in the Wikipedia link under "SEE ALSO" graphically renders (with default colors) as:




How about an animation of the famous "Immortal Game" between Garry Kasparov vs. Veselin Topalov, in 1999?

SEE ALSO
* The code in the examples/ and t/ directories.
* Imager
* http://en.wikipedia.org/wiki/Forsyth-Edwards_Notation
* http://www.chessgames.com/perl/chessgame?gid=1011478 (The "Immortal" game)