summaryrefslogtreecommitdiff
path: root/agent.prolog
blob: 994b77dd48fa6340e7435cae3a1289f7fa7cd938 (plain)
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

:- module(agent, [look/0, move/1, take/1]).


look :-
    here(L),
    writeItemsAt(L),
    writeExits(L).


move(D) :-
    here(L),
    connects(L,N,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.'), !.