summaryrefslogtreecommitdiff
path: root/agent.prolog
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-22 01:02:47 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-22 01:02:47 +1100
commitf59e957d741814459a0dca2993a4d3d4a2325688 (patch)
tree31ce30650735fa50de0aba9268dfbdf797bfe3cc /agent.prolog
parent410fc38f935b552a58af2e716d2fe814eee432c9 (diff)
Reorganising code
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').
+