CSCI 200 - Summer 2023
Foundational Programming Concepts & Design

A2 - Samodelkin Dungeon Crawler

→This assignment is due by Saturday, May 27, 2023, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: L2A, L2B, L2C
→ Do not forget to complete zyBooks Assignment 2 for this set.←

· Instructions · Rubric · Best Practices · Submission Process · Submission Contents ·

For this assignment you will build upon Lab2C - Samodelkin Battle Simulator. The expanded version will feature the hero moving through a series of random rooms, sometimes encountering a monster and acquiring valuable treasure. The following UML diagram lists all the components. Click the image to enlarge the image. More details about each class are given after the image.

Samodelkin Game UML

Item Class


The Item class contains a name and value of some item. There is only a parameterized constructor that sets the name and value properties of the object. There exists an associated getter for the name and value. There are no setters as these value will never be changed once set.


Room class


The Room is the container that holds all the objects of interest for our world. The members of a Room are as follows:


Game class


The Game contains our full game logic. It does not contain many things, but puts everything together. The description of the members are as follows:


Game::play() Instructions


For this assignment, main() will be very simple. Its contents will be:

#include "Game.h"

int main() {
    Game samodelkinGame;
    samodelkinGame.play();
    return 0;
}

All our program logic, and thus game logic, is contained within Game::play(). The following game play needs to be implemented:

You will need to use additional variables to track some of the information necessary to the game state.


Extra Credit


Add a way for the game to "keep score." Count how many rooms the hero has successfully exited. Additionally, maintain an inventory of all treasure gained. Upon game end, print out how many rooms were passed and the total value of treasure collected.


Sample Game Output


Below is a sample running of the game (with the extra credit component):

% ./A2
Gandalf enters Mushroom Circle
You feel like you're being watched.
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: l
There's a monster in here!
There's treasure in here!
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: f
The battle has commenced!
Gandalf attacks Faery dealing 10 damage
Gandalf has vanquished Faery
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: t
You gain Mushroom worth 0.1 doubloons
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: l
There's nothing here
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: e
Gandalf exits Mushroom Circle with 100 health remaining and 0.1 doubloons worth of treasure
Gandalf enters Forest
There's something in the bushes.
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: l
There's treasure in here!
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: t
You gain Rusty Shield worth 1.1 doubloons
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: t
There's no treasure in here.
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: i
Gandalf is currently holding:
        Mushroom (0.1)
        Rusty Shield (1.1)
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: e
Gandalf exits Forest with 100 health remaining and 1.2 doubloons worth of treasure
Gandalf enters Foggy Woods
What's that smell?
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: l
There's a monster in here!
There's treasure in here!
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: t
There's a monster blocking the treasure!
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: e
There's a monster blocking the exit!
What do you want to do?
        L) Look around
        F) Fight monster
        T) Take treasure
        I) Inventory
        E) Exit current room
Choice: f
The battle has commenced!
[...]
Balrog counterattacks Gandalf dealing 12 damage
Balrog has vanquished Gandalf
Gandalf conquered 12 rooms and collected 23.2 doubloons worth of treasure

Best Practices To Follow


· Code Style · Code Correctness · Code Structure · Dynamic Memory Management · Software Engineering Design Principles ·

Code Style

The following set of guidelines ensure all code in this class will be written in a similar and consistent manner, allowing any reader to understand the program's intent and contents.

Code Correctness

The following set of guidelines ensure all programs written in this class behave properly without side effects.

Code Structure

The following set of guidelines ensure all programs written in this class are done in an abstracted, modular, extendable, and flexible manner.

Dynamic Memory Management

The following set of guidelines ensure all programs written in this class behave properly without side effects.

Software Engineering Design Principles

The following set of guidelines ensure all program components written in this class are done in an abstracted, modular, extendable, and flexible manner.


Grading Rubric


Your submission will be graded according to the following rubric.

PointsRequirement Description
15 All labs completed and submitted
L2A, L2B, L2C
4 Die class structured and implemented correctly.
6 Player class structured and implemented correctly.
4 Item class structured and implemented correctly.
8 Room class structured and implemented correctly.
4 Game class structured and implemented correctly.
7 Game::play() follows expected flow.
+3 Extra credit: Game keeps score of rooms passed along with inventory.
5 Best practices are followed:
  • +5 Code is easily readable, follows best practices, well structured
  • +4 Code is easy to follow, only a few small violations of best practices
  • +3 No egregiously bad practices
  • +2 Lots of violations of best practices
  • +1 Little effort to follow best practices
  • +0 No effort to follow best practices
0 Submission structured appropriately. Submissions structured improperly will receive deductions.
53 Total Points

→This assignment is due by Saturday, May 27, 2023, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: L2A, L2B, L2C
→ Do not forget to complete zyBooks Assignment 2 for this set.←


Submission


Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.

It is critical that you follow these steps when submitting homework.

If you do not follow these instructions, your assignment will receive a major deduction. Why all the fuss? Because we have several hundred of these assignments to grade, and we use computer tools to automate as much of the process as possible. If you deviate from these instructions, our grading tools will not work.


Submission Instructions



Here are step-by-step instructions for submitting your homework properly:

  1. Make sure you have the appropriate comment header block at the top of every source code file for this set. The header block should include the following information at a minimum.
    /* CSCI 200: Assignment 2: A2 - Samodelkin Dungeon Crawler
     *  * Author: XXXX (INSERT_NAME) * Resources used (Office Hours, Tutoring, Other Students, etc & in what capacity):  * // list here any outside assistance you used/received while following the * // CS@Mines Collaboration Policy and the Mines Academic Code of Honor *  * XXXXXXXX (MORE_COMPLETE_DESCRIPTION_HERE)  */
    Be sure to fill in the appropriate information, including:
    • Assignment number
    • Assignment title
    • Your name
    • If you received any type of assistance (office hours - whose, tutoring - when), then list where/what/who gave you the assistance and describe the assistance received
    • A description of the assignment task and what the code in this file accomplishes.

    Additionally, update the Makefile for A2 to generate a target executable named A2.

  2. File and folder names are extremely important in this process. Please double-check carefully, to ensure things are named correctly.
    1. The top-level folder of your project must be named Set2
    2. Inside Set2, create 4 sub-folders that are required for this Set. The name of each sub-folder is defined in that Set (e.g. L2A, L2B, L2C, and A2).
    3. Copy your files into the subdirectories ofSet2 (steps 2-3), zip this Set2 folder (steps 4-5), and then submit the zipped file (steps 6-11) to Canvas.
    4. For example, when you zip/submit Set2, there will be 4 sub-folders called L2A, L2B, L2C, and A2 inside the Set2 folder, and each of these sub-folders will have the associated files.

  3. Using Windows Explorer (not to be confused with Internet Explorer), find the files named main.cpp, Die.h, Die.cpp, Game.h, Game.cpp, Item.h, Item.cpp, Player.h, Player.cpp, Room.h, Room.cpp, Makefile.

    STOP: Are you really sure you are viewing the correct assignment's folder?

  4. Now, for A2, right click on main.cpp, Die.h, Die.cpp, Game.h, Game.cpp, Item.h, Item.cpp, Player.h, Player.cpp, Room.h, Room.cpp, Makefile to copy the files. Then, return to the Set2/A2 folder and right click to paste the files. In other words, put a copy of your homework's main.cpp, Die.h, Die.cpp, Game.h, Game.cpp, Item.h, Item.cpp, Player.h, Player.cpp, Room.h, Room.cpp, Makefile source code into the Set2/A2 folder.

    Follow the same steps for each lab to put a copy of each lab's deliverable into the Set2/L2 folders. Do this process for Set2/L2A (main.cpp, Makefile), Set2/L2B (coordinate_conversion.h, coordinate_conversion.cpp, main.cpp, Makefile), Set2/L2C (main.cpp, Die.h, Die.cpp, Player.h, Player.cpp, Makefile).

    STOP: Are you sure your Set2 folder now has all your code to submit?

    The structure of the submission is as follows:
    • Set2/
      • A2/
        • main.cpp
        • Die.h
        • Die.cpp
        • Game.h
        • Game.cpp
        • Item.h
        • Item.cpp
        • Player.h
        • Player.cpp
        • Room.h
        • Room.cpp
        • Makefile
      • L2A/
        • main.cpp
        • Makefile
      • L2B/
        • coordinate_conversion.h
        • coordinate_conversion.cpp
        • main.cpp
        • Makefile
      • L2C/
        • main.cpp
        • Die.h
        • Die.cpp
        • Player.h
        • Player.cpp
        • Makefile
    Include any files denoted by * only if present and appropriate to the implementation.

  5. Now, right-click on the "Set2" folder.
    1. In the pop-up menu that opens, move the mouse "Send to..." and expand the sub-menu.
    2. In the sub-menu that opens, select "Compressed (zipped) folder".

    STOP: Are you really sure you are zipping a Set2 folder with sub-folders that each contain a main.cpp file in it?

  6. After the previous step, you should now see a "Set2.zip" file.

  7. Now visit the Canvas page for this course and click the "Assignments" button in the sidebar.

  8. Find Set2, click on it, find the "Submit Assignment" area, and then click the "Choose File" button.

  9. Find the "Set2.zip" file created earlier and click the "Open" button.

    STOP: Are you really sure you are selecting the right homework assignment? Are you double-sure?

  10. WAIT! There's one more super-important step. Click on the blue "Submit Assignment" button to submit your homework.

  11. No, really, make sure you click the "Submit Assignment" button to actually submit your homework. Clicking the "Choose File" button in the previous step kind of makes it feel like you're done, but you must click the Submit button as well! And you must allow the file time to upload before you turn off your computer!

  12. Canvas should say "Submitted!". Click "Submission Details" and you can download the zip file you just submitted. In other words, verify you submitted what you think you submitted!

In summary, you must zip the "Set2" folder and only the "Set2" folder, this zip folder must have several sub-folders, you must name all these folders correctly, you must submit the correct zip file for this homework, and you must click the "Submit Assignment" button. Not doing these steps is like bringing your homework to class but forgetting to hand it in. No concessions will be made for incorrectly submitted work. If you incorrectly submit your homework, we will not be able to give you full credit. And that makes us unhappy.


→This assignment is due by Saturday, May 27, 2023, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: L2A, L2B, L2C
→ Do not forget to complete zyBooks Assignment 2 for this set.←