humanReadableBoard function
Prints the board as a human readable string format
Implementation
String humanReadableBoard(Board board) {
final buffer = StringBuffer();
for (int y = 7; y >= 0; y--) {
for (int x = 0; x < 8; x++) {
final square = x + y * 8;
final p = board.pieceAt(square);
final col = p != null ? p.fenChar : '.';
buffer.write(col);
buffer.write(x < 7 ? (col.length < 2 ? ' ' : '') : '\n');
}
}
return buffer.toString();
}