swapTiles

fun swapTiles(puzzleState: ArrayList<Int>, blankTileMarker: Int)

Swaps a pair of tiles.

This method is intended to be used for changing the parity of the number of inversions if the puzzle state is initially unsolvable, in effect turning it to a solvable puzzle.

Parameters

puzzleState

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

blankTileMarker

Indicator that the tile is blank.