getIndexFromSquare method

(int, int) getIndexFromSquare(
  1. String square
)

Implementation

(int, int) getIndexFromSquare(final String square) {
  var row = 8 - square[1].codeUnitAt(0) + 48;
  var col = square[0].codeUnitAt(0) - 97;
  if (boardOrientation == PlayerColor.black) {
    row = 7 - row;
    col = 7 - col;
  }
  return (row, col);
}