Room descriptions can be visual, as well as textual and auditory. Display a picture relevant to the room when the room is entered. For extra credit, only show a picture once, and if the room is reentered, repaint the picture to bring it back to the front again.

Note: The answer requires at minimum the addition of pictures being shown in each show room function, as below.

```
#This method prints the description for the Porch
def showPorch():
pic = makePicture("porch.jpg")
show(pic)
printNow("You are on the porch of a frightening looking house.")
printNow("The windows are broken. It's a dark and stormy night.")
printNow("You can go north into the house. If you dare.")
printNow("You can hear something down below.")
if not hand=="Lantern":
printNow("You see a lantern in a corner of the porch")

#This method prints the description for the Entryway
def showEntryway ():
global ghost
pic = makePicture("entryway.jpg")
show(pic)
creak = makeSound("creak.wav")
play(creak)
printNow("You are in the entry way of the house.")
printNow(" There are cobwebs in the corner.")
printNow("You feel a sense of dread.")
#This section adds a description if the ghost is "in" the room
if ghost == 0:
printNow("You suddenly feel cold.")
printNow("You look up and see a thick mist.")
printNow("It seems to be moaning.")
printNow("Then it disappears.")
#This sets the ghost to be "in" the Kitchen
ghost = 1
printNow("There is a passageway to the north and another to the east.")
printNow("The porch is behind you to the south.")

#This method prints the description for the Kitchen
def showKitchen ():
global ghost
global stairsUnlocked
pic = makePicture("kitchen.jpg")
show(pic)
printNow("You are in the kitchen. ")
printNow("All the surfaces are covered with pots,")
printNow(" pans, food pieces, and pools of blood.")
printNow("You think you hear something up the stairs")
printNow(" that go up the west side of the room.")
printNow("It's a scraping noise, like something being dragged")
printNow(" along the floor.")
#This section adds a description if the ghost is "in" the room
if ghost ==1:
printNow("You see the mist you saw earlier.")
printNow("But now it's darker, and red.")
printNow("The moan increases in pitch and volume")
printNow(" so now it sounds more like a yell!")
printNow("Then it's gone.")
#This sets the ghost to be "in" the Entryway
ghost = 0

if hand=="Key" and not stairsUnlocked:
printNow("You notice a hidden, locked door to the west.")
printNow("Good thing you found that key.")
elif stairsUnlocked:
printNow("There's a hidden, unlocked door to the west.")

if not hand == "Crowbar":
printNow("You spot a crowbar among the pots")
else:
printNow("A chunk of wall to the north seems odd ")
printNow(" with the crowbar you may be able to open it.")
printNow("You can go to the south or east.")

#showLR prints the description of the LivingRoom
def showLR():
pic = makePicture("livingroom.jpg")
show(pic)
printNow("You are in a living room.")
printNow("There are couches, chairs, and small tables.")
printNow("Everything is covered in dust and spider webs.")
printNow("You hear a crashing noise in another room.")
printNow("You can go north or west.")
if not hand=="Key" and not stairsUnlocked:
printNow("There is a key here.")
#showDR prints the description of the DiningRoom
def showDR():
pic = makePicture("diningroom.jpg")
show(pic)
printNow("You are in the dining room.")
printNow("There are remains of a meal on the table.")
printNow(" You can't tell what it is,")
printNow(" and maybe don't want to.")
printNow("Was that a thump to the west?")
printNow("You can go south or west")

if not hand == "Bomb" and ogreAlive:
printNow("You spot a bomb on the table.")
#showStairs prints the description of the Stairs
def showStairs():
pic = makePicture("stairs.jpg")
show(pic)
printNow("You are at the bottom of the stairs.")
printNow("The wood of the stairs is old and rotten.")
printNow("To your east is the Kitchen.")
printNow("You can go up the stairs to the Mystry Room.")

#showMR prints the description of the MysteryRoom
def showMR():
global ogreAlive
pic = makePicture("mysteryroom.jpg")
show(pic)
if not ogreAlive:
printNow("Smithereens that used to be an Orge are here.")
else:
printNow("A fearsome Orge sits at the top of the stairs.")
printNow("You can go down to the Stairs.")
#showUW prints the description of the secret Underground World (UndergroundWorld)
def showUW():
pic = makePicture("underground.jpg")
show(pic)
printNow("You are in a vast underground world.")
if hand == "Lantern":
printNow("The lantern reveals a tunnel to the north")
printNow("You can go up to the Porch.")
#showTunnel prints the description of the tunnel off the underground world
def showTunnel():
pic = makePicture("tunnel.jpg")
show(pic)
printNow("You are in a dark, twisting tunnel")
printNow("You can see a shining gold light to the north")
printNow("You can go south to the Underground World.")
#showStorage prints the description of the storage
def showStorage():
pic = makePicture("storage.jpg")
show(pic)
printNow("You are in a small storage area.")
printNow("You can go south to the Kitchen.")
```

Note: For the extra credit, the answer needs to include additional variables to track if a player has entered a room yet or not and the room picture. For example with the porch:

```
porchVisited = false
porchPicture = makePicture("porch.jpg")
#This method prints the description for the Porch
def showPorch():
global porchVisited
global porchPicture

if porchVisited:
repaint(porchPicture)
else:
show(porchPicture)
porchVisited = true
printNow("You are on the porch of a frightening looking house.")
printNow("The windows are broken. It's a dark and stormy night.")
printNow("You can go north into the house. If you dare.")
printNow("You can hear something down below.")
if not hand=="Lantern":
printNow("You see a lantern in a corner of the porch")
```

Computer Science & Information Technology

You might also like to view...

What is not true about desktop computers?

A) They are usually more expensive. B) They are intended to stay in one place. C) They are normally networked. D) They often have separate parts, but not always.

Computer Science & Information Technology

An app store is

A) A place where mobile device drivers are downloaded B) A place to buy apps that do not come free with the mobile device C) A place where mobile accessories are purchased D) A result of mobility features where apps can be previewed

Computer Science & Information Technology