Module Adventure

type place =
  1. | Room of string
  2. | Carried
  3. | Inside of string
  4. | Nowhere
type world = {
  1. here : string;
  2. places : (string * place) list;
  3. flags : string list;
  4. score : int;
  5. turns : int;
}
val start : string -> (string * place) list -> world
val where : world -> string -> place
val put : string -> place -> world -> world
val go : string -> world -> world
val has : world -> string -> bool
val set : string -> world -> world
val unset : string -> world -> world
val visible : world -> string -> bool
val in_room : world -> string list
val carried : world -> string list
type sentence = {
  1. verb : string;
  2. obj : string option;
  3. with_ : string option;
}
type rule = {
  1. verb : string;
  2. obj : string option;
  3. with_ : string option;
  4. test : sentence -> world -> bool;
  5. act : sentence -> world -> world * string;
}
val any : string option
val always : sentence -> world -> bool
val run : rule list -> sentence -> world -> world * string