square method

int square(
  1. int rank,
  2. int file,
  3. int orientation
)

Gets a square id for rank, file and orientation. Orientation can be 0 (white) or 1 (black);

Implementation

int square(int rank, int file, int orientation) =>
    (orientation == Squares.white ? rank : v - rank - 1) * h +
    (orientation == Squares.white ? file : h - file - 1);