From UBC Wiki

Authors: Nafisa Shazia, John Jang

What is the problem?

We wanted to assess the feasibility of using Prolog to build a Civilization game. In Civilization, a user sets out to expand territory and acquire resources. We wanted to implement situations (stages) for the user to encounter and solve by making appropriate choices. In specific, we wanted to demonstrate whether or not Prolog was suitable for implementing the following tasks:

1. Display different text for each stage

2. Implement a natural language interface for user input

3. Update resources based on user choice and probability

4. Build a nondeterministic way to play the game

What is the something extra?

Expanding on some of the tasks listed above:

2.We have global variables that adjust dynamically depending on the user's choice. These are the user’s resources. The game begins with a default number of resources.

3.There is a persistent end condition check on the ‘food’ resource. If the food supply ever dips below 0, the game will end.

4.There are multiple possible outcomes for each choice. The game follows a probabilistic model. The same choice may not always yield the same impact on resources.

What did we learn from doing this?

We learned that although Prolog is not designed for dynamic, probability-based games, it is still feasible for constructing them. The philosophy of Prolog is to search through the knowledge base and retract appropriate answers. The dynamic feature we tried to add as “something extra” is a non-logical extension of Prolog and does not conform to the “Prolog way of thinking”. Therefore Prolog wasn’t the best language to implement our Civilization game. On the other hand, it was very suitable for the other features like the natural language interface.