StatePair

data class StatePair(puzzleState: ArrayList<Int>, blankTilePos: Int)

Pair representing a puzzle state (flattened into one dimension, following row-major order) alongside the position of the blank tile in the puzzle grid (zero-based, following row-major order).

Note that, although the position of the blank tile can be inferred from the puzzle state, it is being tracked in the interest of efficiency (that is, to avoid linear searching).

Parameters

puzzleState

Puzzle state (flattened into one dimension, following row-major order).

blankTilePos

Position of the blank tile in the puzzle grid (zero-based, following row-major order).

Constructors

StatePair
Link copied to clipboard
fun StatePair(puzzleState: ArrayList<Int>, blankTilePos: Int)
Creates an object that represents a puzzle state (flattened into one dimension, following row-major order) alongside the position of the blank tile in the puzzle grid (zero-based, following row-major order).

Properties

blankTilePos
Link copied to clipboard
val blankTilePos: Int
Position of the blank tile in the puzzle grid (zero-based, following row-major order).
puzzleState
Link copied to clipboard
val puzzleState: ArrayList<Int>
Puzzle state (flattened into one dimension, following row-major order).