Bag Of Cows

Pseudo Code Library

The Old Empty Barn

Explanation

On the edge of the village, partly hidden by the trees of Dark Wood, stands the Old Empty Barn.

Local folk law has it that a person could make their fortune just by stepping into it, but at the risk of paying a terrible price.

Carved into the walls of the village church is this ancient inscription.

If thou should approach the Old Empty Barn, perchance a voice will call out to thee.

"Stranger!" It sayeth. "Wilst thou enter this empty barn in pursuit of fame and fortune? Enter thee and partake of the riches within. Enter!"

Go not inside! Lest a terrible fate befall thee!

According to what you can glean from talking to the locals, if you should enter the Old Empty Barn, one of three things will happen.

There is a 4 in 6 chance that when you enter you will find that.

  • It is a barn.
  • It is empty.
  • There is nothing in it.

Disappointed, you will simply leave.

There is a 1 in 6 chance that when you enter the barn, you will find it heaped with treasure of every kind. The barn will start to tremble as the ground beneath heaves and shakes. Fearing it's collapse, you will gather as much treasure as you can carry and flee for your life.

There is a 1 in 6 chance that when you enter the barn, you will find that you are not alone. Inside are the desperate trapped souls of previous unfortunates to come through the door. They reach out and call to you, begging for you to release them, but you cannot. YOU ARE TRAPPED THERE TOO!

Instructions

You have been hired to create a computer program based on the Old Empty Barn legend.

Here are the client's requirements

  1. Produce a flow chart for the client showing how the program will work (e.g. on DrawIO)
  2. On running the program, there should be some sort of graphical display (i.e. ASCII art) of a building in the woods, and the text of the ancient inscription should be displayed.
  3. The player is asked to enter their name, and can't proceed until they do.
  4. The user should be prompted to choose to enter the barn or leave. Only these two choices should be accepted, anything else causes the question to be asked again.
    1. If they choose leave, the program ends.
    2. If they enter, there is some text describing their state of mind as they enter the barn, then a pause (e.g. 2 seconds)
  5. The computer rolls a dice, and if the result is 4 or less, a graphic is displayed showing the empty building. The player is given the choice to leave or play again.
  6. If the result is a 5, a graphic of treasure is shown and the player is told they have three seconds to memorise the treasure. Then a list of the valuable items scrolls quicky up the screen (taking 3 seconds). They are then asked to type in any items they can remember, and all the ones they get right are added to a list of their treasures.
  7. The list of their treasure is shown, and then they are given the choice to play again.
  8. If the result is a 6, there should be a scary graphic (e.g. ghost) and a list of the lost souls trapped in the barn should be displayed (read it from a file) and the player's name needs to be added to the list and saved in the file so that they appear in the list for any subsequent player.

Tips and advice

Any ASCII art you use should be stored in a .TXT file and displayed by reading the file and printing it's contents. If you put your ASCII art in a variable, some of the characters in it might cause problems.

The list of treasure is best also kept in a file. You can read it into an array (with the 'readlines()' command) and then display it on the screen. To make it move up quickly, just print loads of blank lines. You can control the speed with a time.sleep() between them.

Store the lost souls in a file, and append the current user to it.