getDisambiguator method

String getDisambiguator(
  1. StandardMove move, [
  2. List<Move>? moves
])

To be used in cases where, given a piece and a destination, there is more than one possible move. For example, in 'Nbxa4', this function provides the 'b'. Optionally, provide moves - a list of legal moves. This will be generated if it is not specified.

Implementation

String getDisambiguator(StandardMove move, [List<Move>? moves]) {
  // provide a list of moves to make this more efficient
  moves ??= generateLegalMoves();

  return getStandardDisambiguator(
    move: move,
    moves: moves,
    variant: variant,
    state: state,
  );
}