Question: Is this right? Pseudocode or Flowchart for Code to Get an Item INITIALIZE currentRoom = Main Hall Inventory [ ] = 'Get Item LOOP BEGIN

Is this right?

Pseudocode or Flowchart for Code to "Get an Item"

INITIALIZE currentRoom = "Main Hall"

Inventory [ ] = 'Get Item"

LOOP BEGIN

INPUT direction

IF currentRoom IS "Main Hall"

IF direction IS "North"

Get Item = [ ]

currentRoom = "Garden"

ELSE IF direction IS "South"

Get Item = Inventory ["Rock"]

currentRoom = "Living Room"

ELSE IF direction IS "West"

Get Item = Inventory [ "Flashlight"]

currentRoom = "Attic"

ELSE IF direction IS "East"

Get Item = Inventory ["Knife"]

currentRoom = "Kitchen"

ELSE

OUPUT "Invalid Direction"

Get Item = Inventory ["Gun"]

OUTPUT "Wong Item"

OUTPUT

ELSE IF currentRoom IS "Garden"

IF direction IS "South"

Get Item = Inventory ["Rock"]

currentRoom = "Main Hall"

ELSE IF direction IS "East"

Get Item = Inventory [ ]

currentRoom = "Workout Room"

ELSE

OUPUT "Invalid Direction"

Get Item = Inventory ["knife" ]

OUTPUT "Wrong Item"

OUTPUT

ELSE IF currentRoom IS "Workout Room"

IF direction IS "West"

Get Item = Inventory ["Mace"]

currentRoom = "Garden"

ELSE

OUPUT "Invalid Direction"

Get Item = Inventory ["Rock"]

OUTOUT "Wrong Item"

ELSE IF currentRoom IS "Attic"

IF direction IS "East"

Get Item = Inventory [ ]

currentRoom = "Main hall"

ELSE

OUPUT "Invalid Direction"

Get Item = Inventory [ ]

ELSE IF currentRoom IS "Living Room"

IF direction IS "North"

Get Item = [Flashlight"]

currentRoom = "Main hall"

ELSE IF direction IS "East"

Get Item = Inventory [ ]

currentRoom = "Office"

ELSE

OUPUT "Invalid Direction"

Get Item = Inventory ["water"]

OUTPUT "Wrong Item"

ELSE IF currentRoom IS "Office"

IF direction IS "West"

Get Iteam = Inventory ["Gun"]

currentRoom = "Living Room"

ELSE

Get Item = Inventory [" Mace"]

OUTPUT "Wrong Item"

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Kitchen"

IF direction IS "North"

Get Item = Inventory ["Water"]

currentRoom = "Basement"

ELSE IF direction IS "West"

Get Item = Inventory [ ]

currentRoom = "Main hall"

ELSE

Get Item = Inventory ['Flashlight"]

OUTPUT "Wrong Item"

OUPUT "Invalid Direction"

ELSE IF currentRoom IS "Basement"

IF direction IS "South"

Get Item = Inventory [ ]

currentRoom = "Kitchen"

ELSE

Get Item = Inventory ["Gun"]

OUTPUT "Wrong Item"

OUPUT "Invalid Direction"

GOTO LOOP BEGIN

LOOP END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!