Prolog Assignment 1: Text Adventure
Fall 2010, David Matuszek

Purposes of this assignment

General idea

Your assignment is to write an adventure game in SWI-Prolog. Pick any theme you like for your adventure game: rescue, survival, treasure hunt, "a day in the life," or whatever else appeals to you.

Download and install SWI-Prolog from http://www.swi-prolog.org/.

Copy the file adventure.pl and use it as a starting point. This is an absolutely boring game consisting of one room, one object, and one direction you can go (but going in that direction takes you back to the same room). Add to this code to create your own game; if it doesn't do what you want, fix it so that it does. This is free code, to use or modify any way you like. If you don't want to use it, that's OK too.

You can get additional ideas from spider.pl.

Details

Your program should contain one (or more, if you like) of each of the following:

Locked door
In its most boring form, you must find a key and use it to unlock a door, thus giving you access to one or more additional rooms. With a little more imagination: You aren't admitted without a badge. You need to buy a ticket. You must give the troll a gold piece before you can cross the bridge. Waving the magic wand causes the rainbow bridge to appear. Et cetera. Any sort of locked door puzzle will do.
Hidden object
Boring form: You open a box and find something inside. More interesting: You break open a treasure chest. You use the combination to a safe. You peer into the crystal ball. You buy the candy bar from the vending machine. You disassemble the robot to get some part out of it.
Incomplete object
Your flashlight needs batteries. Your gun needs bullets. Your car needs gas. Your bicycle has a flat tire. You need a computer to get at the information on a floppy disk.
Limited resouces
You have a limited amount of time (to find the bomb before it goes off) or money (to buy the things you need), or food, drink, or sleep (so you don't collapse), or some other resource. Maybe you can find more resources in the game, maybe you can't. Depending on just what you decide to do, you may want to figure out how to do arithmetic in Prolog.

You should have a start/0 predicate (similar to the one provided) that my TA and I can use to start your game and find out what commands you have added. Don't make us look at the code to figure out how to run your program!

Grading

Your program should work, should satisfy the above requirements, and should be reasonably formatted. Grading may not be 100% objective. If we like your game, we may give you extra points for it. If your game seems to lack creativity and interest, you may lose points.

Due date

Tuesday, September 14, before midnight. Zip and turn in to Blackboard a file containing (1) your .pl source code, (2) a transcript of a sample run of your program, and (3) a readme.txt file that briefly describes your game, and in particular briefly describes your locked door, hidden object, incomplete object, and limited resource. A standard penalty of 5 points per day late will apply.

Do not turn in a file in any other format that .zip, such as .rar.

If you don't have access to Blackboard, get the matter resolved beforehand. I do not, under any circumstances, accept assignments submitted by email.