MCD4720 - Fundamentals of C++

MCD4720 - Fundamentals of C++

Assignment 2 and 3 - Trimester 3, 2020

Assignment Submissions

This project will be submitted in two parts. Both parts of the assessment are equally important for the successful completion of your project, so it is essential that you understand the requirements of both parts before you start.

Assignment 2: Hunt the Wumpus (Part A: Project Plan)

Due Date: December 9, 2020, 11:55PM (Week 8)

Marks: This assignment will be marked out of 100 points.

Weighting: 10% of your final mark for the unit.

This assignment is the first part of a larger project, which you will complete in Assignment 3. This task consists of your project planning documentation. It will include details of the requirements & analysis of your program, including UML Class diagrams.

The purpose of this assignment is to get you comfortable with planning a C++ programming project for Assignment 3. The task is detailed later in this assignment specification, as are the specific marks allocation.

Assignment 3 :: Hunt the Wumpus (Part B: C++ Project Implementation)

Due Date: January 9, 2021, 11:55PM (Week 10)

Marks: This assignment will be marked out of 100 points.

Weighting: 20% of your final mark for the unit.

This assignment consists of your implementation of your project, as outlined in your Project Planning document (Assignment 2).

Your project must follow your project plan and must be submitted as a Visual Studio project, including all header and .cpp files, and any appropriate text files to ensure the program compiles and runs.

This assignment consists of one Application file and associated custom Class files. The purpose of this assignment is to get you comfortable with designing and implementing basic multi-class C++ programs. The task is detailed later in this assignment specification, as arethe specific marks allocation.

Late submission:

  • By submitting a Special Consideration Form or visit this link: https://lms.monashcollege.edu.au/course/view.php?id=1331
  • Or, without special consideration, you lose 5 marks per day that you submit late (including weekends). Submissions will not be accepted more than 10 days late.

This means that if you got Y marks, only (Y-n×5) will be counted where n is the number of days you submit late.

Marks: This assignment will be marked out of 100 points, and count for 10% of your total unit marks.

Plagiarism: It is an academic requirement that the work you submit be original. If there is any evidence of copying (including from online sources without proper attribution), collaboration, pasting from websites or textbooks, Zero marks may be awarded for the whole assignment, the unit or you may be suspended or excluded from your course.
Monash Colleges policies on plagiarism, collusion, and cheating are available here or see this link: https://www.monashcollege.edu.au/__data/assets/pdf_file/0010/17101/dip-assessment-policy.pdfFurther Note: When you are asked to use Internet resources to answer a question, this does not mean copy-pasting text from websites. Write answers in your own words such that your understanding of the answer is evident.
Acknowledge any sources by citing them.

Submission Instructions:

This project will be submitted in two parts:

Assignment 2 – Part A: consists of your project planning documentation.

This document will include an outline of your program structure and UML Class diagrams.

The assignment must be created and submitted as a single Word or PDF document to the Moodle site. This document must clearly identify both your Name and Student ID to facilitate ease of assessment and feedback.

Your document file MUST be named as follows:

YourFistNameLastName_A2.docx” or “YourFistNameLastName_A2.pdf”.

This file must be submitted via the Moodle assignment submission page.

The document should contain the project plan and the UML diagrams. You can use Microsoft Visio to draw the UML diagrams or you can use any other software, provided that the diagrams are included in your submitted document.

Explicit assessment criteria are provided, however please note you will also be assessed on the following broad criteria:

✓ Detail of a proposed project plan for the overall project.
✓ Creating accurate and complete UML diagrams.
✓ Applying a solid Object-Oriented Design (OOD) for the overall project
✓ Using appropriate naming conventions, following the unit Programming Style Guide.

Assignment 3 – Part B: consists of your implementation of your game project.

Your project must follow your project plan and must be submitted as a Visual Studio project, including all header and code files, and any appropriate text files to ensure the program compiles and runs.

You may complete the tasks in your preferred IDE, however you MUST create a Visual Studio project in order to submit. Your project folder must be identified by using your name and assignment number, such as YourFirstNameLastNameID_A3.

The entire project folder must then be zipped up into one zip file for submission. The zip file MUST be named “YourFistNameLastName_A3.zip”. This zip file must be submitted via the Moodle assignment submission page.

Explicit assessment criteria are provided, however please note you will also be assessed on the following broad criteria:

✓ Meeting functional requirements as described in the assignment description
✓ Demonstrating a solid understanding of C++ concepts, including good practice
✓ Demonstrating an understanding of specific C++ concepts relating to the assignment tasks, including object-oriented design and implementation and the use of Pointers
✓ Following the unit Programming Style Guide
✓ Creating solutions that are as efficient and extensible as possible
✓ Reflecting on the appropriateness of your implemented design and meeting functional requirements as described in the assignment description

NOTE! Your submitted program MUST compile and run. Any submission that does not compile will automatically awarded a 50 marks penalty. This means it is your responsibility to continually compile and test your code as you build it.

NOTE! Your submitted files must be correctly identified and submitted (as described above). Any submission that does not comply will receive an automatic 20 marks penalty (applied after marking). For assignment 3, your Visual Studio project should include all .cpp and .h files.

If you have any questions or concerns please contact your tutor as soon as possible.

Assignment 2: Hunt the Wumpus (Part A)

In this assignment, you are to write an action adventure game, where your hero character will set out to find and kill the notorious Wumpus in a complex of caverns. You must use your powers of deduction and stealth to sneak up on the location of the Wumpus because no-one come face to face with a Wumpus and lives!

For Part A of the assignment you will focus on the planning of the project. In Part B you will focus on creating the various interactive objects in the game and program the player interactions.

“Well met, young adventurer and welcome to the peaceful realm of Silven Valley. Actually, it used to be peaceful until the Wumpus, a vile creature, took up residence in caverns nearby.

It has been terrorising the villages all along the valley for a long time now.

So, the elders from the villages have banded together to offer fame and fortune to the worthy adventurer who will rid their valley of this dreaded monster! You have answered the call and have been told by the elders that the creature is lurking in one of the cavern complexes in the surrounding hills.

All you have to do is find the creature and slay it ... simple! Good luck!! You'll need it!”

Basic Game Play

The Wumpus lives in an underground cavern consisting of 20 smaller caves. Each cave has 3 tunnels leading from it to other caves. One example of a cavern complex is shown here (like a squashed dodecahedron).

Besides the Wumpus, there are several other hazards that could be fatal. These include two caves with bottomless pits – if you happen to go into them, you fall into the pit (and lose). Two other caves have super bats – if you stumble in them, you are immediately carried away by the bats and left in a random cave (would be annoying to say the least).

The Wumpus, on the other hand, is not bothered by these hazards (he has sucker feet and is too big for the bats to lift). It is usually asleep, only waking up if you blunder into its lair or if your shot goes astray (clattering weapons do echo quite loudly underground). If you do manage to wake a Wumpus there is a 75% chance that it will move to an adjoining cave or it may decide (25% chance) to go back to sleep where it is. If it moves to the same cave you are in … you become lunch (and you lose).

When entering the caverns, you have a map, a lantern that has a limited amount of oil which also sets the number of turns you have (starts with 100), and you are armed with a bow and 5 arrows. Each turn, you may move to an adjacent cave, using one of the 4 standard compass directions [N, S, E, W] (which also reduces your lantern oil) or shoot an arrow into a cave [shoot] (hopefully hitting the Wumpus and killing it).

Your lantern oil will be reduced by a random value between 2 and 4 when you move or shoot.

Also, we can look at the location of the Wumpus, pits and super bats by little bit cheating.


Hazards

When you enter a new cave, if you are one cave away from the Wumpus or a hazard, you will be given a clue indicating what is in one (or potentially more) of the caves leading from your current location but not the direction in which it lies.

  • Bottomless Pits: they tend to be drifty, very deep and easy to fall into! They will just kill you outright, should you fall into one. So, watch your step!
  • Super Bats: a colony of these bats makes an awful racket and are very protective of their domain. If you happen to wander into their cave, they’ll swam you and carry you off to some random cave within the caverns.
  • Wumpus: a nasty beast that smells really dreadful and sleeps a lot. If it’s awake and you’re in the same cave then you’re its lunch … a truly horrible way to die. The Wumpus is not bothered by pits or bats so is free to roam anywhere in the caverns.

End game conditions

  • You win if you successfully shoot the Wumpus.
  • You lose if your lantern runs out of oil, or you run out of arrows, or you fall into a pit, or you end up in the same cave as the Wumpus. You should try to avoid these things!

Note: The theme of the game can be any setting you like, so long as the main element equivalents (Wumpus and hazards, limited turns, and resources) and general game play as described above are present.

You should include a title and a brief description of the caves to make the game interesting and engaging for the player. You may use the techniques you developed in the first assignment to load and display this data.

Project Plan

Having a clear plan for your project before you begin coding is essential for finishing a successful project on time and with minimal stress. So, part of this assignment is defining what will be in your project and what you need to do to actually develop it.

Important: You must also read the requirements for Assignment 3 in order to be able to complete the documentation required for Assignment 2.

The documentation you must submit will include the following:

A description of “How to Play”

This will be the information you display on the opening screen of your game to inform the player what they need to do in order to play and win the game. Do not just copy the game play description above, make your own description.

Note: This description must be saved as a text file and read into your game when the program begins. You can also use this as a convenient way to display “help” if the player asks for it.

A development outline of your game

Using a simple outline format (numbered or bullet points) state the main actions that the program will have and then, as sub-points, state the things you will need to do to make that happen.

The outline structure should contain all the elements of your game, as this is a high level description of your approach to the development of your program. You should include at least the following headings and provide examples of happens under each section.

  • The game setup (everything that happens before the game starts)
  • The player’s turn (the sequence of events that happen during a turn)
  • Processing player input (include each of the commands your player can use)
  • Providing feedback to the player (in response to the player’s interactions)
  • The end game conditions (include all win and lose conditions)
  • Additional Features included, if any – see Assignment 3
  • Outline the functionality of all your game classes – see Assignment 3

Here is an example to get you started with your project outline:

The Game Setup

  • Display an overview of the game rule so the player knows what to do to win.
  • read this information from a text file
Initialise the game elements:
  • add the player – ask for the player’s name, set default variables
  • all the other things that will happen during initialisation including
  • creating the hazards and the game world
  • initialising other game variables (list them here)

As you can see, you only have to describe the actions the program will take, not the code, for the outline. The idea here is to give you a starting point for when you start writing your code as you can use this as a checklist of the things you need to include.

✓ UML Diagrams

UML diagrams are designed to make structuring your program easier. How to create them will be covered in class, but the general structure is shown here – see Assignment 3 for more details about classes.

You will need UML diagrams for each of the classes you include in your game – at least a Player, Location and Application (main) class.

✓ Map of Your Game Environment

In order to make marking easier for your tutors, please include a map of your game environment. This can be hand drawn or created in another application (PowerPoint has a range of shapes and connectors that make mapping easy). See example below.

Assignment 2: Marking Criteria [100 marks in total]

1.  Requirements and Analysis Document (Project Plan) [80]

1.1.     Description of the rules (the introduction to your game) [8]

1.2.     Outline includes all game functionality (from Part B) [12]
1.3.     Each section is broken into logical tasks [15]
1.4.     Tasks are performed in a logical order [15]
1.5.     Task descriptions given provide sufficient detail [30]
2. UML Diagrams [20]

2.1.     Correct structure used (Name, Attributes, Behaviours) [4]

2.2.     Included the correct designations for public (+) and private (-) data [8]
2.3.     All variables and functions have meaningful names [8]

Assignment 3: Hunt the Wumpus (Part B)

You are to implement the Hunt the Wumpus game you started in Assignment 2 by creating a Visual Studio Project using your project plan as described in your previous submission.

Your completed Hunt the Wumpus game must demonstrate the following:

✓ You MUST implement your program using the following classes, as a minimum, you may include more (as appropriate for your game design):

  • Player class: holds the player’s details including their name and the equipment they are carrying (arrows, lantern [turns], map, etc.).
  • Location class: holds details of the various locations in game including a description, exits, and whether it has a hazard or not (you can call it whatever is appropriate for your game – Cavern, Cave, Room, etc.)
  • Application file: holds the main() function and controls the overall flow of the game.

You may include other relevant attributes and behaviours to these classes, as identified in your project plan.

✓ The Player must be able to do the following:

  • assign a name which is requested at the start of the game and used in the feedback given
  • assign the player’s initial attributes to the required values (as stated in the brief)
  • update and display the player’s statistics (stats) during the game
  • explore the game locations using the compass directions: N, S, E, W
  • shoot arrows at the Wumpus: shoot
  • look at the locations of Wumpus, pits and super bats at any time: cheat
  • quit the game at any time (during or after a game): QUIT
✓ The Locations must be able to do the following:
  • be loaded from a text file and stored appropriately at the start of the game
  • assign a name and initialise attributes (as stated in the brief)
  • access and display data about a hazard if it is in the location
  • display all appropriate information when the player enters it (name or number, description,exits, other information if required)
✓ The Game Application must do the following:
  • display the “how to play” information at the start of the game
  • initialise both the player and the hazards with appropriate attributes/behaviours
  • display an appropriate and uncluttered user interface providing relevant information to the player at all times
  • allow the player to explore the locations of the caverns using compass directions
  • display the information about each location as it is entered (name, direction of exits, etc.)
  • terminate the game (player wins) when the player has killed the Wumpus
  • terminate the game (player loses) when the player has run out of oil in their lantern (turns) or arrows, or is eaten by the Wumpus
  • provide player stats at the end of the game (success or failure, inventory, etc.)
  • the player should be able to QUIT the game at any time
Program Reflection

You must also provide a 300-word written reflection of your object-oriented design and how well you believe it was to implement. You should cover the following areas:

Discuss why you designed it the way you did.

  • Why did you create your classes that way?
  • How does this reflect an OO design or approach?

Discuss how well you were able to code it

  • Highlight any issues you found once you tried to implement your design.
  • How did you resolve these issues?

If you were to do this project again, discuss how you might change your design to make your solution easier to implement, more efficient, or better for code reuse.

This must be a Word or PDF document which must be included in the same folder as your *.sln file. Your document file MUST be named as follows:

YourFirstNameLastNameID_A3.docx” or “YourFirstNameLastNameID_A3.pdf”.
Extra Functionality

The marking criteria indicates that you should make some individual additions to this in order to achieve the final 20% of the mark.

Following is a list of additional features you can include, with the maximum number of marks [x] you can earn for each one. You may implement one or more features from the list, but you will only score up to the maximum of 20% of the total assignment marks or 20 marks.

You should aim to add some additional creative elements to the gameplay, as well as advanced object-oriented design elements or advanced use of pointers.

a. The player can select a skill level (eg: Rookie, Hunter and Master Hunter) which modifies the game parameters – the number of caves, the number turns the lantern lasts, the number of arrows they have, the number of hazards placed in the caves, what items they can buy and/or find, etc. [2]

b. Implement an appropriate scoring system based on the game parameters – number of turns taken, a bonus for unused arrows, +/- point based on a win/loss at the skill level, etc. [2]

c. The Wumpus could move one cavern after a random number of turns taken by the player, so the player has to find the Wumpus before it moves too often. [2]

d. Add a theme to the game which is incorporated into the game play through the story and the feedback given (for example: Treasure Hunters, Save the Dragon from the Princess, etc.). This may change the end game conditions, such as instead of killing the Wumpus the player has to find one or more treasures and return to the village. You must still implement all other elements of the game as described in the brief. [3]

e. Create a number of different maps. You should have at least 3 different maps prepared, one of which is randomly selected and loaded at the start of the game. You must still implement all other elements of the game as described in the brief. look at the map of the caverns at any time: MAP [6]

f. Allow the game to be saved and restored at the player’s request. [4]

g. Display the hazards and/or game locations using ASCII art. [4]

h. The player can collect useful items to help them survive, either before the game starts (eg: select or buy from a “shop”) or they find them as they explore the game locations. Items should be suitable to your game theme: such as a rope to climb out of a pit, a whistle to confuse the bats, extra oil to fill the lantern, etc. [5]

i. The arrows are magical crooked arrow which can be shot through 1 to 5 caves. You aim by typing SHOOT and a list of 1-5 directions in which you want the arrow to go (SHOOT N, E, S, S, W). If the arrow can't go that way (ie: no tunnel) it chooses a random exit from that cave before moving to the next cave. If the arrow hits the Wumpus, you win. If the arrow hits you, you lose. [7]

j. Create roaming opponents (to suit your theme – monsters, other treasure hunters, etc.) that the player has to defeat and/or avoid while exploring the game locations. These opponents can be randomly generated before the game and placed randomly throughout the locations or they can be randomly generated as required (linked to a skill level, a random number of turns, etc.). Each opponent should also have a special action that they will do when they encounter the player (fight, steal an item, talk, exchange items, etc.) based on the type of “character” they are. [10]

You certainly do not have to implement all of the above to earn marks for extra functionality. Just remember the maximum number of marks you can earn are given in [x]. It is up to you!

For those of you who are curious, you can also explore the following links:

Original article: https://www.atariarchives.org/bcc1/showpage.php?page=247

Wumpus 2 article: https://www.atariarchives.org/bcc2/showpage.php?page=244

Combined articles: https://www.atariarchives.org/morebasicgames/showpage.php?page=178

Assignment 3: Marking Criteria [up to 100 marks in total]

Does the program compile and run? Yes or No

50 marks penalty will be applied for a non-compiling program.

1. Class Design [15]

1.1. Player Class [5]

1.1.1. Has an appropriate header file [2]

1.1.2. Required data members and member functions using meaningful names [1]

1.1.3. Contains only aspects that relate to a “player” (has no data members or member functions that are not directly related to a Player) [2]

1.2. Location Class [5]

1.2.1. Has an appropriate header file [2]

1.2.2. Required data members and member functions using meaningful names [1]

1.2.3. Contains only aspects that relate to a “board” (has no data members or member functions that are not directly related to the board) [2]

1.3. Game Application [5]

1.3.1. Has an appropriate header file [2]

1.3.2. Has appropriate variables and functions using meaningful names [2]

1.3.3. The main() function has appropriate function calls to keep it uncluttered [1]

2. Functionality [35]

2.1. Game set up including: displaying “how to play” information, initialising the player and game variables, creating the hazards using appropriate data, etc. [5]

2.2. Implementation of a clear and uncluttered User Interface display [5]

2.3. Successful implementation of the basic navigation mechanics [5]

2.4. Successful implementation of the hazards and their effects on the player [5]

2.5. Successful implementation of shooting the Wumpus and correct consequences [5]

2.6. Successful implementation of action processes and feedback displayed to the player [5]

2.7. Appropriate end game conditions triggered [5]

3. Quality of Solution and Code [20]

3.1. Does the program perform the functionality in an efficient and extensible manner? [12]

3.1.1. Appropriate use of functions and function calls [1]

3.1.2. Appropriate use of data types [1]

3.1.3. Appropriate use of decisions, loops and other programming techniques [2]

3.1.4. Appropriate use of references and/or pointers [5]

3.1.5. Appropriate use of good programming practices and techniques [2]

3.1.6. Extraneous and redundant code removed [1]

3.2. Has a well-designed OO program been implemented? [4]

3.2.1. Contains classes appropriate to the assignment brief [3]

3.2.2. Program structures support and OO design [1]

3.3. Has the Programming Style Guide been followed appropriately? [4]

3.3.1. Appropriate commenting and code documentation [2]

3.3.2. Correct formatting of code within *.h and *.cpp files [2]

4. Extra Functionality [20]

4.1. Implement difficulty levels which may be selected by the player [2]

4.2. Implement an appropriate scoring system based on game parameters [2]

4.3. The Wumpus could move after a random number of turns [2]

4.4. Incorporate a theme into the story and feedback given to the player [3]

4.5. Create and implement a number of different maps [3]

4.6. Allow the game to be saved and restored at the player’s request [4]

4.7. Display the hazards and/or game locations using ASCII art [4]

4.8. The player can buy/collect useful items to help them survive [5]

4.9. Use magical crooked arrows which can be shot through 1-5 locations [7]

4.10. Create and implement roaming opponents for the player to interact with [10]

5. Reflection [10]

5.1. Discussion of motivations for the program design [3]

5.2. Discussion of how well the design was to implement [3]

5.3. Discussion of what they would do differently if they were to start it again [4]

Assignment Notes:

It is your responsibility to know what is expected of you. If you are unsure about anything, ask your tutor sooner rather than later. Write any questions and/or notes here to help you clarify what you have to do.

Note: Your tutor may ask you to program part of your assignment in class to determine that you have completed the work yourself. Failure to do this to an acceptable level will result in you being referred to the Subject Leader for plagiarism.

In-Class interviews: Also, you may be required to demonstrate your code to your tutor after the submission deadline. Failure to demonstrate will lead to zero marks being awarded to the entire assignment.

Note: Submitting only .sln file, a zero mark will be granted.

Here are some sample screen shots to help you develop your user interface:







发表评论

电子邮件地址不会被公开。 必填项已用*标注