bitIndex(row, col, littleEndian?)

Returns the bit index of the cell at (row, col) when the quadrille is encoded into a bitboard using row-major ordering.
By default, the index follows big-endian layout, where the most significant bit (MSB) maps to the top-left cell.
Set littleEndian to true to reverse this mapping, placing the least significant bit (LSB) at the top-left instead.

Example for a 2×3 quadrille:

  • Big-endian layout (default):
| 5 | 4 | 3 |
| 2 | 1 | 0 |
  • Little-endian layout:
| 0 | 1 | 2 |
| 3 | 4 | 5 |

Syntax #

bitIndex(row, col[, littleEndian])

Parameters #

ParamDescription
rowNumber: row index of the cell [0..height]
colNumber: column index of the cell [0..width]
littleEndianOptional Boolean: if true, bit index is computed using little-endian layout
Also available as the static method Quadrille.bitIndex(row, col, width = 8, height = 8, littleEndian = false), which allows computing bit indices independently of any specific quadrille.