DropMove.fromUci constructor

DropMove.fromUci(
  1. String uci
)

Constructs a DropMove from a UCI string.

Throws a FormatException if the UCI string is invalid.

Implementation

factory DropMove.fromUci(String uci) {
  final role = Role.fromChar(uci[0]);
  final to = Square.parse(uci.substring(2));
  if (role != null && to != null) {
    return DropMove(to: to, role: role);
  }
  throw FormatException('Invalid UCI notation: $uci');
}