diff_months: 19

Engineering Programming C++ assessment

Download Solution Now
Added on: 2022-11-04 05:29:02
Order Code: 474213
Question Task Id: 0
  • Subject Code :

    ENSE503

  • Country :

    Australia

The assignment is to write a C/C++ program for the game “Where is my key?”.The aim of the game is to find your car key in one of the rooms of your house.

  • The house has 6
  • Each room has a name. One of the rooms is named ‘entrance hall’. This is where you
  • Every room has 3 doors to one other room
  • Some doors are locked at
  • The layout of the house, i.e. which room is connected to which other room by a door, is different every time the program runs.

At the start of the program:

  • A startup message is
  • The “elapsed time” is set to
  • One room is selected to have the missing key (but it is not revealed to the user).
  • The first turn starts. Each turn proceeds as follows:
  1. The elapsed time is
  2. The program prints the name of the room that you are
  3. The program prints the names of the three rooms that you can go to (by using a door).
  4. The program lets the user enter an The options are:
    1. The user enters “q”. Then the program prints an end message and
    2. The user enters “s”. Then the elapsed time is incremented by a random number from 1 to 3. If the player is in the room with the keys, then the elapsed time is printed, followed by an end message, and the program Otherwise, a message is displayed that the key is not in the room, and the next turn starts.
    3. The user enters “h”. Then the program prints the name of the room with the key, the elapsed time is incremented by one, and the next turn
    4. The user enters the name of a Then…
      1. If the room is the same as where the player already is, then the elapsed time is incremented by two and the next turn
      2. If the room is accessible via an unlocked door, then the elapsed time is incremented by one and the player moves to the new
  • If the door to the room is locked, then the program gives the option to unlock the door. If the player chooses to unlock the door, then the elapsed time is incremented by one and the door will be open in future turns. Either way, the player does not move to another room, yet, and a new turn starts.
  1. If the user input is not valid (e.g. no valid room name or no door to the room), then an error message is displayed and the next turn

For the details, please refer to the examples given at the end of this document.

Hints

  • The general hints from the first assignment still
  • The example solution internally identifies rooms by a room number from 0 to 5. This is easier to handle than room names. For display, the name of the room is looked up from a string array using the room number.
    • To process the user input, it helps to write a function that looks up the name of the room in the array and returns the room
    • To randomise the room layout, you could randomly exchange room names at program start.
  • To see if rooms are connected by a door, or doors are locked, you could write a 2D array indexed by the current room number and another room number.
  • If you find these hints confusing, then it’s probably better to do it your own

Difficulty/accuracy of the assignment

  • It is not required to implement the full functionality to pass this assessment. You can submit a simplified solution. Please consult the marking scheme below to estimate how many marks you might get for an incomplete solution.
  • There is some freedom to do things your own way, but it should be in the sense of the assignment and not to gain an unfair advantage.
  • Correct solutions for this assignment can be vastly different. The example solution has about 170 lines of code including comments and empty
  • Uploaded By : Katthy Wills
  • Posted on : November 04th, 2022
  • Downloads : 0
  • Views : 175

Download Solution Now

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more