Square

class Square

This enum represents the squares on the chessboard. The order is set such that when calling ordinal, the integer 0 corresponds to A1, 1 corresponds to B1, and so on, following the file-major order (A1, B1, C1... H1, A2, B2... H8), with 63 corresponding to H8.

This is a facade created to enable exporting the code to JS, though it can also be used directly within the JS modules of any KMP project.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun getCol(): Int

Returns the zero-based index of the column (file) for this square. The index starts at 0 for the A-file and ends at 7 for the H-file.

Link copied to clipboard
fun getRow(): Int

Returns the zero-based index of the row (rank) for this square. The index starts at 0 for the 1st rank and ends at 7 for the 8th rank.