我被这个问题困住了......
isAt(keys, room3).
isAt(book, room3).
isAt(keys, room6).
isAt(keys, room4).
目前,room3 有钥匙和书。我想打印钥匙和书。我试过这段代码,显然只打印了一个。(只是键)
look :- isIn(Location),
write('You are in '),
write(Location),
nl,
items_inroom(Location),
nl.
items_inroom(Location) :-
isIn(Location),
isAt(Item, Location),
write('Available Item(s):'),
write(Item),
nl.
items_inroom(_) :-
write('Available Item(s): None'),
nl.
items_inroom 是试图打印所有这些事实的代码。我该如何处理?任何帮助都会很棒!谢谢你。