Coordinate

data class Coordinate(val row: Int, val col: Int)

Represents a coordinate on the board.

Constructors

Link copied to clipboard
constructor(row: Int, col: Int)
constructor(row: Int, col: Char)

Creates a coordinate from a row and a column character.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val col: Int

The column index (1-based).

Link copied to clipboard
val row: Int

The row index (1-based).

Functions

Link copied to clipboard
fun isValid(boardSide: Int): Boolean

Checks if the coordinate is valid for the given board size.

Link copied to clipboard
operator fun minus(other: Coordinate): Coordinate

Subtracts one coordinate from another.

Link copied to clipboard
operator fun plus(other: Coordinate): Coordinate

Adds two coordinates together.