boardSymbols method

List<String> boardSymbols([
  1. bool full = false
])

Converts the internal board representation to a list of piece symbols (e.g. 'P', 'q'). You probably need this for interopability with other applications (such as the Squares package).

Implementation

List<String> boardSymbols([bool full = false]) {
  List<String> symbols = [];
  for (int i = 0; i < board.length; i++) {
    if (full || size.onBoard(i)) {
      int piece = board[i];
      String symbol = piece.isEmpty ? '' : variant.pieces[piece.type].symbol;
      symbols.add(
        piece.colour == Bishop.white
            ? symbol.toUpperCase()
            : symbol.toLowerCase(),
      );
    }
  }
  return symbols;
}