NAME
Game::Checkers::Piece - one man or king on the board
VERSION
Version 0.01
SYNOPSIS
use Game::Checkers::Piece;
my $piece = Game::Checkers::Piece->new(
colour => 'black',
king => 0,
square => 11,
);
$piece->stringify; # 'b'
$piece->value; # 1
DESCRIPTION
A piece object is built on demand by "piece" in Game::Checkers::Board. It is never what the engine stores: a position is an array of signed integers, because the search copies one for every node it visits. See "PROPERTIES" in Game::Checkers::Board for that encoding.
PROPERTIES
colour
Readonly string, black or white.
$piece->colour;
king
Readonly boolean, true for a crowned piece.
$piece->king;
square
Readonly integer, the square 1 to 32 the piece stands on.
$piece->square;
FUNCTIONS
from_value
Class method building a piece from a position value and a square, returning undef for an empty square.
Game::Checkers::Piece->from_value(-2, 21); # a white king on 21
value
The position encoding of the piece: 1 a black man, 2 a black king, -1 a white man and -2 a white king.
$piece->value;
is_black
True for a black piece.
is_white
True for a white piece.
stringify
One letter: b a black man, B a black king, w a white man, W a white king. This is the spelling FEN uses.
$piece->stringify;
ui_stringify
The Unicode draughts symbol for the piece, for a terminal that can print one.
$piece->ui_stringify;
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-game-checkers at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Game-Checkers. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Game::Checkers
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)