Disservin / chess-library

C++ chess library
https://disservin.github.io/chess-library/
MIT License
79 stars 21 forks source link

feat: compressed board #109

Closed Disservin closed 2 months ago

Disservin commented 2 months ago

API:

using PackedBoard = std::array<std::uint8_t, 24>;

normal

Board board     = Board("4k1n1/pppppppp/8/8/8/8/PPPPPPPP/4K3 b - - 0 1");
auto compressed = Board::Compact::encode(board);
auto newboard   = Board::Compact::decode(compressed);

chess960

Board board = Board("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w AHah - 0 1", true);

auto compressed = Board::Compact::encode(board);
auto newboard   = Board::Compact::decode(compressed, true);