generateMovesForPiece method
Generate moves for a determined piece Receives the square where the piece is on, in case there is none piece returns empty []
Implementation
List<Move> generateMovesForPiece(
{required String fromSquare, bool legal = true}) {
List<Move> moves = [];
if (get(fromSquare) == null) return moves;
moves = generateMoves({'legal': legal});
if (moves.isNotEmpty) {
moves.removeWhere((element) => element.fromAlgebraic != fromSquare);
}
return moves;
}