Graphviz::DOT::Chessboard

Chessboard plot using the Graphviz DOT language.

Graphviz::DOT::Chessboard

Raku package for making chessboard plots via the DOT language of Graphviz.

Installation

From Zef ecosystem:

zef install Graphviz::DOT::Chessboard

From GitHub:

zef install https://github.com/antononcube/Raku-Graphviz-DOT-Chessboard.git

Basic usage

Load the package:

use Graphviz::DOT::Chessboard;

Generate DOT spec:

say dot-chessboard(4, 4, title => 'Example small chessboard'):!svg;

Generate an SVG plot:

my %opts = black-square-color => 'SandyBrown', white-square-color => 'Moccasin', :4size;
dot-chessboard(8, 8, |%opts):svg;

image ./docs/empty-chessboard.svg not found

Using a FEN string (on a smaller board):

my $fen = '8/8/8/3K4/5r2/8/1k6/8';

dot-chessboard($fen, :5r, :6c):svg

image ./docs/small-chessboard.svg not found

Here is a way to specify the initial position of a 5x5 chess (in a "green style"):

my %opts-green = black-square-color => '#779556ff', white-square-color => '#ebecd0ff',  white-piece-stroke-color=> 'LightGray';
my $fen = '8/8/8/rnbqk3/ppppp3/8/PPPPP3/RNBQK3';

dot-chessboard($fen, :5r, :5c, :4size, |%opts-green, background=>'none', :svg)

image ./docs/initial-position-5x5.svg not found

TODO

  • DONE White pieces should have contours

  • DONE Chess positions by Forsyth-Edwards Notation (FEN) strings

  • TODO Fuller set of unit tests

  • TODO CLI script

References

[AAp1] Anton Antonov, Graph Raku package, (2024), GitHub/antononcube.

[AAp2] Anton Antonov, Graphviz::DOT::Grammar Raku package, (2024), GitHub/antononcube.

Graphviz::DOT::Chessboard v0.0.6

Chessboard plot using the Graphviz DOT language.

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

Graph:ver<0.0.24+>FEN::Grammar:ver<0.0.6+>

Test Dependencies

Provides

  • Graphviz::DOT::Chessboard

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.