C++代写:MCD4720 Text Advanture


Task Details

This assignment is the first part of a larger project, which you will complete in Assignment 2.

The purpose of this assignment is to get you comfortable with planning, writing, compiling and testing a (relatively) short C++ program using basic programming constructs. It is detailed later in this assignment specification, as is the specific marks allocation.

The assignment must be created and submitted as a Visual Studio 2017 project. You may complete the exercises in your preferred IDE, however you should create a Visual Studio project in order to submit.

Your project folder must be identified by using your name and assignment number, such as YourFirstNameLastNameA1. The entire project folder must then be zipped up into one zip file for submission. The zip file MUST be named “YourFirstNameLastNameID.zip”. This zip file must be submitted via the Moodle assignment submission page.

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

  • Detail of a proposed project plan for the overall project
  • Meeting functional requirements as described in the exercise description
  • Demonstrating a solid understanding of the C++ concepts covered, including good practice
  • Following the unit Programming Style Guide
  • Creating solutions that are as efficient and extensible as possible

NOTE! Your submitted program MUST compile and run. Any submission that does not compile will be awarded zero marks. This means you should continually compile and test your code as you do it, ensuring it compiles at every step of the way.

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

Assignment Task: Text Adventure

A text adventure is an interactive story that unfolds as the player progresses through it. The player has a defined goal and is presented with some information which they must read then decide what to do next by typing in simple commands. Depending on the command typed, the story will progress to the next appropriate section. The player repeats this process until they either reach their goal, or fail and have to start over again.

For Part A of the assignment you will focus on the planning of the project and programming the setup stage of the game and some simple interactivity. In Part B you will focus on creating the various interactive objects in the game and program the remaining 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 them … simple! Good luck!! You’ll need it!”

Basic Game Play

NOTE: This is a full overview of the game. Not all of this is required for Assignment 1. See below for specifics

The Wumpus lives in an underground cavern consisting of 25 smaller caves. Each cave has 4 tunnels leading from it to other caves. One example of a cavern complex is shown here (small 5x5 grid).

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 a cave with them, you fall into the pit (and lose). Two other caves have super bats - if you stumble into 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 its lunch (and you lose).

When entering the caverns, you have a lantern that has a limited amount of oil, and you are armed with a bow and 5 arrows. Each turn, you may move to an adjacent cave, using one of the listed possible cave exits [numbered according to your map] (which also reduces your lantern oil) or shoot an arrow into an adjacent cave [FIRE room number] (hopefully hitting the Wumpus and killing it).

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 drafty, 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.

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 2 in order to be able to complete the documentation required for Assignment 1.

The documentation you must submit will include the following:

A brief description for the setting of your text adventure.
This could be the blurb you have on the splash screen of your game to set the atmosphere and inform the player what they need to do in order to win the game. You can use the introduction above (in italics) as a template for your description.

Note: The theme of the game can be any setting you like, so long as the main element equivalents (the number of locations and exits, Wumpus and hazards, limited turns and resources) and general game play as described above are present. Some alternative setting may include: a haunted house, an abandoned castle, a mysterious island, a maze, etc.

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
  • The player’s turn
  • Processing player input
  • The end game
  • Additional Features included, if any - see Assignment 2

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

  • The Game Setup
    • Display an overview of the game for the player to read so they know what to do to win.
    • Initialise the game elements:
      • load in the location data from a file and store in a list
      • add all the other things that will happen during initialisation including creating and placing the “hazards” in random locations, initialising tracking variables, etc.
    • Ask the player for their name and set the player’s starting location:
      • add all the things that you want to have for the player

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.

Project Prototype

For the coding part of this assignment you will define all the major elements of your game, display an appropriate “introduction screen” and demonstrate some simple player interactions - HELP, QUIT and moving around the caverns using the given exits.

Your initial prototype must demonstrate the following:

  • Display an introduction screen introducing the player to the game, setting the atmosphere that appears when the program runs.
  • Display a help screen that is accessed when the player types “H” at the prompt.
  • Display the map of a the cave system
  • The game ends when the player types “Q” at the prompt.

Hint: The data for all of the above must be read from a text file (“intro.txt”, “caves.txt”, “help.txt”, etc.). This would be particularly useful for loading the cave locations and exits in an array to make processing and displaying information more efficient.

The player input should be limited to single characters or numbers to make processing the actions easier.

The format should be something similar to:

“Do you want to [M]ove, [S]hoot or [Q]uit? “

Here is some sample output of a game displays. Note this is just a suggestion for the prototype submission for Part 1. In Part 2 you can include descriptions and other feedback as required.

Assignment 1: Marking Criteria

Project Plan

  • Description of the setting (the introduction to your game)
  • Outline includes all game functionality (includes both Parts A and B)
  • Each section is broken into logical tasks
  • Task descriptions given provide sufficient detail
  • Tasks are performed in a logical order

Project Prototype

  • Functionality
    • Does the program compile and run? Yes or No Zero marks for code that does not compile
    • Does the introduction screen display when the game runs?
    • Does the player interaction trigger the correct response?
    • Has Help been included and display correctly?
    • Has the location data been loaded and stored appropriately?
    • Can the player see a location details?
    • Can the player QUIT the program correctly?
  • Quality of Solution and Code
    • Does the program perform the functionality in an efficient and extensible manner?
    • Has the Programming Style Guide been followed appropriately?
    • Is there appropriate documentation throughout the program?