-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtestgame
45 lines (43 loc) · 1.78 KB
/
testgame
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
% -*- prolog -*-
'The test game':
[
object(bread,'a loaf of bread','The bread seems extremely durable.'),
object(lighter,'a lighter','A real Zippo.', [turned_off]),
object(gas,'','You smell gas.', [flammable]),
description_if(lighter, turned_on, 'The lighter sports a clear burning flame.'),
trigger(lighter, ( % FIXME: this should be a for_each
next_to(lighter, Obj),
is(lighter, turned_on),
is(Obj, flammable),
set(on_fire(Obj)),
{answer('The flame of the lighter ignites the ~w.', [Obj])},
trigger(Obj))),
object(oven,'grandmother\'s oven.',
'It is made out of shiny white emaille.', [can_be_opened,container, turned_off]),
assert(after(turn_on(S, S1, oven)) :-
(answer('You hear a clicking noise and the sound of gas streaming into the oven.'),
put_assoc(inside(gas), S, oven, S1),
( inside_of(lighter, oven, S1, S1)
; answer('The ignition mechanism appears to be broken.')))),
description_if(oven, burning, 'The oven is burning hot.'),
description_if(oven, [not(burning), turned_on], 'Gas is streaming into the oven.'),
trigger(gas, (
is(gas, on_fire),
next_to(gas, Obj),
is(Obj, flammable),
is_not(Obj, on_fire),
set(on_fire(Obj)),
trigger(Obj))),
location([living,room], 'A cosy living room.',[kitchen],[lighter]),
location(kitchen,'The kitchen is small.',[[living,room]],[gnome,oven]),
inside(oven, bread),
object(gnome, 'A garden gnome made out of a waxy material.',
'Even for a gnome he seems unusually hairy.', [flammable]),
trigger(gnome, (is(gnome, on_fire),
{answer('The gnome begins to melt away.')},
replace(gnome, gold))),
object(gold, 'a lump of hot gold', 'The gold was inside the gnome figurine.'),
person(man, 'An old and quiet man.'),
inside([living,room], man),
inside(inventory, lighter)
]-kitchen.