/
say.ml
65 lines (49 loc) · 1.27 KB
/
say.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(*
* Copyright (C) 2007-2010 The laby team
* You have permission to copy, modify, and redistribute under the
* terms of the GPL-3.0. For full license terms, see gpl-3.0.txt.
*)
let good_start =
F.x "I'm ready" []
let bad_start =
F.x "Something went wrong" []
let wall_in =
F.x "I can't go through the wall." []
let rock_in =
F.x "I can't go through this rock." []
let exit_in =
F.x "I can't go through the door." []
let web_in =
F.x "Oops, a spider web." []
let web_out =
F.x "I can't move anymore." []
let exit =
F.x "Wohoo, the exit!" []
let no_exit =
F.x "I can't find a door to open." []
let carry_exit =
F.x "I can't go out carrying a rock." []
let take_nothing =
F.x "There's no rock to take here." []
let drop_nothing =
F.x "I have nothing to drop." []
let drop_no_space =
F.x "I can't drop the rock here." []
let action f =
begin function
| `None -> ()
| `Rock_Take -> ()
| `Rock_Drop -> ()
| `Wall_In -> f wall_in
| `Rock_In -> f rock_in
| `Exit_In -> f exit_in
| `Web_In -> f web_in
| `Web_Out -> f web_out
| `Exit -> f exit
| `No_Exit -> f no_exit
| `Carry_Exit -> f carry_exit
| `Take_Nothing -> f take_nothing
| `Drop_Nothing -> f drop_nothing
| `Drop_No_Space -> f drop_no_space
| `Say s -> f (F.s s)
end