Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone tell me if I completed my Pseudocode correctly? Please let me know if there are any corrections that I can make. I have

Can someone tell me if I completed my Pseudocode correctly? Please let me know if there are any corrections that I can make. I have attached the instructions below that is italicized and further down is my pseudocode. Thank you!

  1. These will give you an understanding of how the text-based game should work. As you read, consider the following questions:
    • What are the different steps needed in this program? How might you outline them in a way that a computer can understand?
    • What information would you need from the player at each point (inputs)? What information would you output to the player at each point?
    • When might it be a good idea to use IF and IF ELSE statements?
    • When might it be a good idea to use loops?
    • When might it be a good idea to use functions (optional)?
  2. Create pseudocode or a flowchart that logically outlines the steps that will allow the player to move between rooms using commands to go North, South, East, and West. Use your notes from Step #3 to help you design this section of code. Be sure to address the following:
    • What input do you need from the player? How will you prompt the player for that input? How will you validate the input?
    • What should the program do if the player enters a valid direction? What output should result?
    • What should the program do if the player enters an invalid direction? What output should result?
    • How will you control the program flow with decision branching and loops?
  3. Create pseudocode or a flowchart that logically outlines the steps that will allow the player to get the item from the room they are in and add it to their inventory. Use your notes from Step #3 to help you design this section of code. Be sure to address the following:
    • What input do you need from the player? How will you prompt the player for that input? How will you validate the input?
    • What should the program do if the player enters a valid item (the item in their current room)? What output should result?
    • What should the program do if the player enters an invalid item (an item not in their current room)? What output should result?
    • How will you control the program flow with decision branching or loops?

PSEUDOCODE:

INITIALIZE currentRoom = "Great Hall"

LOOP BEGIN

INPUT direction

IF currentRoom IS "Great Hall"

IF direction IS "North"

currentRoom = "Library"

ELSE IF direction IS "South"

currentRoom = "Lavatory"

ELSE IF direction IS "West"

currentRoom = "Bedchambers"

ELSE IF direction IS "East"

currentRoom = "Gardens"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Cellar"

IF direction IS "South"

currentRoom = "Great Hall"

ELSE IF direction IS "East"

currentRoom = "Kitchen"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Kitchen"

IF direction IS "West"

currentRoom = "Library"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Bedchambers"

IF direction IS "East"

currentRoom = Great hall"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Lavatory"

IF direction IS "North"

currentRoom = "Great Hall"

ELSE IF direction IS "East"

currentRoom = "Gatehouse"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Gatehouse"

IF direction IS "West"

currentRoom = "Lavatory"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Gardens"

IF direction IS "North"

currentRoom = "Cellar"

ELSE IF direction IS "West"

currentRoom = "Great Hall"

ELSE

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Cellar"

IF direction IS "South"

currentRoom = "Gardens"

ELSE

OUPUT "Invalid Direction"

GOTO LOOP BEGIN

LOOP END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions