Course:CPSC312-2016-Project1- One-Day-In-the-Life-of-A-UBC-Student

From UBC Wiki

One Day in the Life of a UBC Student

Authors: Li Jye Tong, Kevin Wu, Alex Chung

What is the problem?

We will make a text-based game that accepts user queries to advance. Obstacles in the game come in the form of impediments a student would encounter upon waking up and attending school. Source of inspiration:

What is the something extra?

We will include a stamina system into the game. Actions or consequences due to these actions either increase or decrease your stamina. If the stamina runs out, the game ends.

What did we learn from doing this?

(This should be written after you have done the work.)

-We learned that even a simple game requires a lot of coding

-At first, it was a struggle to come up with the way to make the avatar dynamic (being able to change locations, add time, deduct stamina). However, after some research, we were able to make it seem dynamic by asserting a new time/location/stamina, and at the same time, retract the previous data. With the assertion and retraction method, we were able to generally make the game with infinite command possibilities (as each command can either manipulate time, stamina, and/or location).

-Time was a bit harder to handle, as we tried to make it 4 digit as ( hour hour : minute minute), but the problem is that it is hard to program prolog to take in cases when the minutes go beyond 60 (an hour). Therefore we separated our "time" to "hours" and "minutes".

-We learned that helper functions can decrease the amount of work required on writing the commands. By finishing one helper function (such as the addtime that handles the adding of hours and minutes when you input commands), each command will have significantly reduced coding.

- We took inspiration and made use of a function from an example online to take sentences and change them into a list format (i.e. brush my teeth --> [brush,my,teeth]).

- We also defined noun phrases as determiners followed by nouns, stand alone nouns, or a query (i.e. what is) followed by a determiner followed by a noun. Commands would be interpreted as a verb followed by a noun phrase, or a verb by itself.

- Overall, our grammar would not follow regular English grammar.

- Every command incremented time by a certain amount. Redoing actions results in needlessly incrementing time. Game is ended at certain checkpoints if you have performed too many actions/take too much time.

Additonally, because prolog does not allow any prompts at start, so the players must put the input "start" to start the game.

-So bottom-line: Prolog actually deals with text-based-adventure games really well (as each function becomes a template for the next one, just require manipulations of a few constants). However, the implementation of natural language becomes really hard for Prolog to handle without more complex code. Additionally, Prolog is also bad at handling unexpected commands.