algebraic method

String algebraic({
  1. BoardSize size = BoardSize.standard,
  2. bool useRookForCastling = false,
})

Provides the most basic algebraic form of the move. This is not entirely descriptive, and doesn't provide information on promo or gated pieces, for example. Use Game.toAlgebraic in almost every situation.

Implementation

String algebraic({
  BoardSize size = BoardSize.standard,
  bool useRookForCastling = false,
}) {
  String fromStr = from == Bishop.hand ? '@' : size.squareName(from);
  String toStr = size.squareName(
    (castling && useRookForCastling) ? castlingPieceSquare! : to,
  );
  return '$fromStr$toStr';
}