From UBC Wiki


Authors: Trevor Ott, Dylan Weicker

What is the problem?

Prolog will be used to implement a Clue Game played between a single human and AI. There are 21 cards to represent 6 people, 6 weapons, and 9 rooms. 9 cards will be known to the AI, 9 will be known to the human, and 3 cards (one person, one weapon, and one room) will be unknown. The human and the AI will take turns guessing which cards are unknown. If a player guesses a card which is known by the opponent, the opponent will reveal knowledge of that card to disprove the original player's guess. The first player to guess all three unknown cards is the winner.

What is the something extra?

We would use assert and retract to create a state based system in prolog. This will be necessary to ensure that the knowledge gained by the AI persists between turns. Our AIs are able to ask educated questions based on the knowledge that they have to obtain new knowledge. One of the two will eventually gain enough knowledge to solve the problem.

What did we learn from doing this?

Logical Programming is suitable for a state-based game like Clue. It's easy to keep track of information gained by players and artificial intelligences. Our AI was able to keep track of the cards that it was shown and make future educated guesses based on this information.

What we learned: Functions with zeero arity Dynamic state using assert and retract and dynamic variables Printing Applying if-then logic to prolog Interactive AI that makes decisions based on knowledge base; procedural game state creation Using random permutation to shuffle lists