-
Notifications
You must be signed in to change notification settings - Fork 0
/
tileInventory.mli
31 lines (23 loc) · 1.12 KB
/
tileInventory.mli
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
(** Module representing the tile inventory for players. *)
(** [t] is the type of a tile inventory. *)
type t
(** [tile] is the type of a tile. *)
type tile = Letter of char | Blank
(** [next_tile t] is the next tile to be drawn from the tile inventory,
followed by a tile inventory with the tile [tile] removed. *)
val next_tile : t -> tile option * t
(** [tiles_left t] is the number of tiles left a player has in his
or her tile inventory. *)
val tiles_left : t -> int
(** [draw i t] is a list of [i] tiles drawn from [t] and a new [TileInventory.t]
with those tiles rremoved. *)
val draw : int -> t -> tile list * t
(** [from_file f] is the list of possible tiles read from the file [f]. *)
val from_file : string -> t
(** [string_of_tile t] is the string representing the either the letter
on tile [t] or a blank tile. *)
val string_of_tile : tile -> string
(** [tile_of_char c] is the tile represented of the character [c]. ['_']
represents the blank tile, while all lowercase letters a-z represent their
corresponding tiles. Precondition: [c] in ([[a-z]] + ['_']). *)
val tile_of_char : char -> tile