Allow Board::color_at to return empty squares colour
Closed this issue · 3 comments
Suyashtnt commented
It would be useful for turning a board into e.g emojis
pub fn create_emoji_board(board: Board) -> String {
let mut board_str = String::new();
for sq in Square::ALL {
let piece = board.piece_at(sq);
if let Some(piece) = piece {
// use the piece to generate emoji
} else {
let col = board.color_at(sq); // If there is no piece at said square, return the
// blank squares colour
}
}
board_str
}
niklasf commented
Hi. You can use sq.is_dark()
or sq.is_light()
.
Suyashtnt commented
Hi. You can use
sq.is_dark()
orsq.is_light()
.
I am a stupid
niklasf commented
Nah, this is easy to miss. Black/white are used for pieces in this lib, and dark/light used for squares.