summaryrefslogtreecommitdiff
path: root/agent.prolog
diff options
context:
space:
mode:
Diffstat (limited to 'agent.prolog')
-rw-r--r--agent.prolog54
1 files changed, 53 insertions, 1 deletions
diff --git a/agent.prolog b/agent.prolog
index 994b77d..0c1d445 100644
--- a/agent.prolog
+++ b/agent.prolog
@@ -1,7 +1,24 @@
-:- module(agent, [look/0, move/1, take/1]).
+:- module(agent, [init, look/0, move/1, take/1]).
+:- consult('parser.prolog').
+:- consult('map.prolog').
+
+
+
+
+% initialisation
+
+init :-
+ retractall(here(_)),
+ asserta(here(a)), !.
+
+
+
+
+% command functions
+
look :-
here(L),
writeItemsAt(L),
@@ -23,3 +40,38 @@ take(T) :-
asserta(holding(T)),
write('Taken.'), !.
+
+
+
+% letting the player know what's going on
+
+writeItemsAt(L) :-
+ itemAt(X,L),
+ description(X,D),
+ write(D),
+ fail.
+writeItemsAt(_) :- true.
+
+
+writeExits(L) :-
+ connects(L,_,D),
+ join(['You see an exit to the ',D,'.\n'],M),
+ write(M),
+ fail.
+writeExits(_) :- true.
+
+
+
+
+% basic facts about the maze
+
+itemAt(ladder,a).
+
+
+canTake(gold).
+canTake(deadWumpus).
+
+
+description(ladder, 'There is a rope ladder hanging from the ceiling here.\n').
+description(gold, 'You see a glitter along the sandy floor of the cave.\n').
+