package knights_tour

  1. Overview
  2. Docs
type t

A GameState.t represents the complete state of the game at a given Point.t in time. This includes the state of the board as well as the current position of the knight on the board.

val make : int -> t

Creates a 'fresh' gamestate consisting of an empty board and the knight at its starting position.

val valid_moves : t -> move list

Returns a list of moves that is currently valid given the current state of the game.

val steps : t -> int

Returns the number of steps the knight has taken so far. Placing the knight at the start position is counted as a step. (So the number starts a 1 on a 'fresh' board)

val board : t -> Board.t

Returns current state of the board.

val do_move : t -> move -> t

Update the game state by doing a given move.

val isWinning : t -> bool

Decide whether the current state represents a winning / solved state.