package knights_tour

  1. Overview
  2. Docs

Module Game.GameStateSource

Sourcetype 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.

Sourceval make : int -> t

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

Sourceval valid_moves : t -> move list

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

Sourceval 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)

Sourceval board : t -> Board.t

Returns current state of the board.

Sourceval do_move : t -> move -> t

Update the game state by doing a given move.

Sourceval isWinning : t -> bool

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

OCaml

Innovation. Community. Security.