type piece = Black | White
type move = Pass | Square of int

(* dir -> square -> square option , where dir is 0-7 with 0 = north *)
val nextSquare : int -> int -> int option
val searchDirs : int -> int list
    
type t				(*board state type*)

val initial : unit -> t			(*make an initial board state*)
    
(* can use this to recreate a board from a saved game.  Args are
   an 64 array of the board, whose turn it is next, and the last
   move made *)
val of_array : (piece option) array -> piece -> move -> t
    
val blackPieces : t -> int		(*number of black pieces on board *)
val whitePieces : t -> int		(*ditto for white pieces*)

val copy : t -> t			(*copy a game state*)

    (* call a function on each square of the board *)
val iter : (piece option -> unit) -> t -> unit
    (* call f as (f square owner) on each square of board *)
val iteri : (int -> piece option -> unit) -> t -> unit

    (*get contents of a square*)
val get : t -> int -> piece option
val set : t -> int -> piece option -> unit
    
val turn : t -> piece
val lastMove : t -> move
val indices : t -> int array

val opponent : piece -> piece

val canMove : t -> piece -> bool
val legalMove : t -> piece -> move -> bool
val legalMoves : t -> piece -> move list
val makeMove : t -> piece -> move -> t

(* I/O *)
val string_of_piece : piece -> string
val string_of_move : move -> string
val printBoard : t -> unit
val printBoardTop : t -> unit
