Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antononcube/raku-graphviz-dot-chessboard
Making chessboard plots via Graphviz DOT language.
https://github.com/antononcube/raku-graphviz-dot-chessboard
chess chess-position chessboard graphviz graphviz-dot graphviz-dot-language raku rakulang
Last synced: about 5 hours ago
JSON representation
Making chessboard plots via Graphviz DOT language.
- Host: GitHub
- URL: https://github.com/antononcube/raku-graphviz-dot-chessboard
- Owner: antononcube
- License: artistic-2.0
- Created: 2024-11-29T13:38:57.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-05T00:32:40.000Z (2 months ago)
- Last Synced: 2024-12-15T14:16:25.513Z (about 2 months ago)
- Topics: chess, chess-position, chessboard, graphviz, graphviz-dot, graphviz-dot-language, raku, rakulang
- Language: Raku
- Homepage: https://raku.land/zef:antononcube/Graphviz::DOT::Chessboard
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Graphviz::DOT::Chessboard
Raku package for making chessboard plots via the
[DOT language](https://graphviz.org/doc/info/lang.html)
of
[Graphviz](https://graphviz.org).-----
## 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:
```raku
use Graphviz::DOT::Chessboard;
```Generate DOT spec:
```raku
say dot-chessboard(4, 4, title => 'Example small chessboard'):!svg;
```Generate an SVG plot:
```raku
my %opts = black-square-color => 'SandyBrown', white-square-color => 'Moccasin', :4size;
dot-chessboard(8, 8, |%opts):svg;
```![](./docs/empty-chessboard.svg)
Using a FEN string (on a smaller board):
```raku
my $fen = '8/8/8/3K4/5r2/8/1k6/8';dot-chessboard($fen, :5r, :6c):svg
```![](./docs/small-chessboard.svg)
Here is a way to specify the initial position of a 5x5 chess (in a "green style"):
```raku
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)
```![](./docs/initial-position-5x5.svg)
------
## TODO
- [X] DONE White pieces should have contours
- [X] 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](https://github.com/antononcube/Raku-Graph),
(2024),
[GitHub/antononcube](https://github.com/antononcube).[AAp2] Anton Antonov,
[Graphviz::DOT::Grammar Raku package](https://github.com/antononcube/Raku-Graphviz-DOT-Grammar),
(2024),
[GitHub/antononcube](https://github.com/antononcube).