-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.ml
33 lines (24 loc) · 1.01 KB
/
game.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(**The abstract signature representing any game*)
module type Game = sig
(**The abstract type representing game state*)
type t
(**The abstract type representing a parsed player input*)
type command
(**[init_state] is an abstract value representing the initial state of a game*)
val init_state : t
(**[max_players] is the number of clients that must connect to the server
for a game to start*)
val max_players : int
(**[next_state t p_id command] returns the abstract state of the game after
a player with [p_id] inputs a string corresponding to [command].*)
val next_state : t -> int -> command -> t
(**[parse s] returns the [command] corresponding to [s]. The implementation
depends on the game*)
val parse: string -> command
(**[print_player_state t id] is a string representing the perspective of the
player corresponding to [id]*)
val print_player_state: t -> int -> string
(**String that is the title of the game*)
val name: string
val terminal_size: int * int
end