This is your C++ lab. It consists of programming a small text-based game purely in C++.
Important: if you have already completed this project in another language, I recommend that you do not try translating your existing code into C++. It will be a lot more trouble than starting from scratch.
You can find a complete description of the project in this pdf document. You can also download and execute the Java bytecode of the completed game to better get a grasp of it.
The description above says you should use XML as input. To make the project a little easier, I am changing a few things. First, there will be no names and descriptions for anything in the game, only numbers (as in room number 0); change the game output accordingly. In addition, I am changing the input definition to the following:
When the game starts, it takes from standard input (so no files are opened/closed/used in the project code) input in the following format:
n (integer, the number of rooms, 1 < n < 100)
The next n lines are the following:
state north south east west (five integers, signifying the cleanliness of the room and the numbers of the respective neighbors. State can be 0 for clean, 1 for half-dirty, 2 for dirty. -1 signifies no neighbor. Numbering of the rooms starts at 0)
The next line is:
m (integer, the number of creatures, 1 < m < 100)
The next m lines are:
creatureType location (two integers; creatureType is 0 for the PC, 1 for an animal, 2 for an NPC. Location is the number of the room the creature is in. Numbering starts at 0)
The input will be well-formed according to the above description and the game specification (i.e., you should not worry about checking for errors in the input such as putting an animal in a dirty room from the start and the like).
After the above is read from stdin, the game should continue reading game commands from stdin.
Make sure that you use as few globals as possible, and that you use good OOP techniques.
Here is an example input block:
To that input corresponds the following output:
You should submit your source file(s) to the Angel dropbox. Your code should compile with the g++ on rho. If it requires any command-line parameters when compiling, specify them in the comment box in Angel when you make your submission.
Do not underestimate the project. It is sufficiently large to require all the time you have. Start early in order to finish on time.