canMoveTile

fun canMoveTile(direction: FlingDirection, position: Int, blankTilePos: Int, numColumns: Int): Boolean

Checks if the given tile can be moved in the specified direction.

Return

true if the tile can be moved in the specified direction; false, otherwise.

Parameters

direction

Direction in which the tile will be moved.

position

Position of the tile to be moved (zero-based, following row-major order).

blankTilePos

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

numColumns

Number of columns in the puzzle grid.