From 410fc38f935b552a58af2e716d2fe814eee432c9 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 21 Mar 2014 03:01:42 +1100 Subject: Basic items and look command --- agent.prolog | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'agent.prolog') diff --git a/agent.prolog b/agent.prolog index 338b3f2..994b77d 100644 --- a/agent.prolog +++ b/agent.prolog @@ -1,9 +1,11 @@ -:- module(agent, [look/0, move/1]). +:- module(agent, [look/0, move/1, take/1]). look :- - write('looking\n'). + here(L), + writeItemsAt(L), + writeExits(L). move(D) :- @@ -12,3 +14,12 @@ move(D) :- retract(here(L)), asserta(here(N)), !. + +take(T) :- + here(L), + itemAt(T,L), + canTake(T), + retract(itemAt(T,L)), + asserta(holding(T)), + write('Taken.'), !. + -- cgit