Sunday, 18 August 2013

Castle of Fear (The Micro User type-in) - 4: Solution / Walk-through

This game has several random events, so the walk-through cannot be guaranteed to work every time.

Goal of the game: to win the game, you must to collect all three coins (Bronze, Silver and Gold) and then place one each in 3 consecutively-aligned rooms. At the same time, a wandering troll is attempting to do the same with the jewels found in the castle. If he succeeds first, then you are struck to death on the spot!

However the starting position of the coins is the same with every game. The following walk-through should result in a win after a few tries.

Castle of Fear Walk-through
Starting from the Guests Lounge: E, N, N, W, W, S, S, D, G (get Bronze coin), E, E, U, G (get Silver coin), W, U, E, N, N, W, W, G (get Golden coin), L (drop Golden coin in North end of King's bedroom), E, L (drop Silver coin in Queen's bedroom), E, L (drop Bronze coin in Northern end of N/S passage). If all has gone well, all three coins should now be aligned in a straight row and you win!

Castle of Fear (The Micro User type-in) - 3: Hints

Some hints for playing:

1. What do I need to do to complete the game?
2. How do I escape from the Trap room (north of the Guests' Lounge)?
3. How many coins are there in the game, and where are they?
4. How is the type of coin that you pick up determined?
5. How many jewels are there in the game?
6. What are the rules for picking up and dropping objects?
7. What purpose is the FEED ME room?
8. Where does the coin go when dropped in the Queen's dressing chamber?
9. What is the troll trying to do? 
10. What is the meaning of the messages "You hear a distant SLUURP!" and "You hear a distant WHOOF!"
11. What benefit is the Attack command?
12. Where does the coin go when stolen by a sprite?

Hint 1:

The aim of the game is to collect all 3 coins (Bronze, Silver and Gold) and then place them in a straight line, by leaving one in each of 3 consecutive rooms in the castle. This must be done within the time-limit of 100 turns, and the game will end if the wandering troll similarly succeeds in placing 3 jewels in a straight line in the castle.

Hint 2:

It is not possible to escape from this room, so avoid going north from the Guests' Lounge. If you accidentally wander in, you will need to restart.

Hint 3:

There are 3 coins in the game. At the start of the game, the coins are in the following rooms: North end of King's bedroom, South end of dining room and Bottom of well.

Hint 4:

The type of coin that is picked up is determined by how many coins the player is carrying already. If it is the first coin, it will be Bronze; if it is the second coin, it will be Silver; if it is the third coin it will be Golden.

Hint 5:

There are 4 jewels in the game. The game starts with the troll carrying one, and there are 3 others placed in the castle.

Hint 6:

The player can pick up only coins; the troll can pick up only jewels. The player cannot drop a coin in a room that already contains an object (jewel or coin).

Hint 7:

This is a red herring. Dropping a coin here results in it being lost permanently, making the game unwinnable.

Hint 8:

If you drop a coin in the Queen's dressing chamber, it rolls away down a hole and is placed in the Trap room (making the game unwinnable).

Hint 9:

The troll wanders the castle, randomly choosing between a room with a jewel, the room the player is in, or another random room. He will attempt to pick up a jewel if it is in the room he visits, and drop a jewel if the room is empty (if he is carrying one). His objective is to place 3 jewels in a straight line in the castle i.e. one jewel in 3 consecutive rooms. If he does this, the player loses and is killed instantly.

Hint 10:

These messages occur when the wandering troll picks up or drops a jewel, respectively, and is in another room.

Hint 11:

There is no benefit in using this command, and it can result in your death (if you use it when the troll is in the same room and is carrying a jewel).

Hint 12:

It is placed in a random room in the castle (except for the Trap room). You can find it again by searching the castle.

Saturday, 17 August 2013

Castle of Fear (The Micro User type-in) - 2: Random Events

As you wander the castle, there are various random events taking place, leading to various messages on the screen.

  • "A small dwarf walks up to you, says 'Hurry up', and then walks off." This message occurs with a 9% probability at first, and shows with increasing frequency as the number of turns used increases. It is just there to pressure the player.
  • "Listen, you can hear strange voices." Just a random message for atmosphere.
  • Your coin is stolen by a sprite: if you are carrying a coin, there is a chance (7%) it will be taken from you and placed in a random room of the castle. There is no way to avoid this.
  • Troll behaviour:
    • Movement of the troll: each turn, the troll moves randomly to one of the following rooms: a room that contains a jewel; the room the player is currently in; or a random room in the castle (note, he does not actually traverse the rooms in-between!).
    • The troll may in fact carry multiple jewels at once, however this is not obvious to the player who is told only that the troll is carrying a jewel.
    • If the troll is carrying a jewel, he will drop it in the room if it does not contain one already. This gives the message "You hear a distant WHOOOF!"
    • Otherwise, if the room a troll is in contains a jewel, then the troll will pick it up. This gives the message "You hear a distant SLUURP!"
    • There are 4 jewels in total. At the start of the game, there are 3 jewels placed around the castle and the troll is carrying one.
  • You are killed suddenly by an event (such as a pendulum dropping from the ceiling). Although it is not obvious to the player, this is actually triggered by the troll's interaction with the jewels. You are killed if he succeeds in placing a jewel in each of 3 consecutively-aligned rooms in the castle.

Castle of Fear (The Micro User type-in) - 1

Game Description

Castle of Fear is a text adventure that was published in August 1984 edition of The Micro User magazine as a BASIC type-in. The input method is restricted to a small set of command keys (representing compass directions, GET, DROP, INVE, ATTACK etc).

Castle Of Fear: instructions (but they don't give away much!)

Game Locations

All the game's 27 locations are accessible to you from the start (although one room is a trap and has no exits; at least the game does warn you not to enter!).

There are no typical adventure-like puzzles involving keys or other problems to be found. However there is a troll who wanders the rooms, randomly dropping or picking up jewels (you are unable to pick these up). There are also 3 coins to be found in the castle which you can collect. The type of coin you pick up is determined by how many you are holding already; your first coin is denoted as a Bronze coin; the second is Silver and the third is a Golden coin.

Game Objective

The magazine blurb for the game points out that it was written so that even the person who types it in cannot work out how to solve it. Having said that, the game offers no real clues as to its solution that I have been able to find, so I took a look at the code in more detail. Fortunately, unlike the last text adventure game I looked at (Adventure by Program Power) the code is not obfuscated greatly and can be examined fairly readily.

Castle of Fear: game in play
The instructions merely instruct you to "escape" from the castle and give you a time limit of 100 turns in which to do so.

From examining the program code, to win the game you must to collect all three coins and then place one each in 3 consecutively-aligned rooms in the castle. The trick here is that the type of coin (Bronze, Silver or Gold) is decided when you actually pick it up, based on how many you are carrying already. If you are carrying no coins, the next coin you pick up will be Bronze; if carrying one coin then the next will be Silver; if carrying two coins then it will be Gold.

At the same time, a wandering troll is attempting to do the same with the jewels found in the castle. Caution: if the troll succeeds first, then you are struck to death on the spot!

Castle of Fear Disk Image

An image of the game suitable for playing with the BeebEm emulator can be found at the 8-Bit Software site. Click here for a direct link to the image (zipped).

Wednesday, 7 August 2013

Adventure by Program Power - 6: Odds and Ends

Having a look through the message text table for the game reveals several interesting messages which are in fact never used in the game. They suggest features which may have been originally planned but were not implemented.


  • Your treasure has been stolen. In the classic Colossal Cave adventure there is a thief who randomly steals your belongings. However there is no thief in this version.
  • Night is falling. Perhaps this was intended to be displayed as a warning that time is running out.
  • Splendid, splendid. At a guess, this may have been the intended response for when the player confirms the game's question "Are you carrying a lamp?". (In the actual game, there is no response).
  • Do you really want a hint? Presumably it was intended for the game to prompt the player after a command of HELP / HINT.
  • Are you bored with this? This could have been meant for inclusion as one of the random comments (e.g. "I am bored, bored, bored" etc) that is made by the game when more than 100 turns have passed.
  • There is bread here. Aha, the dream sequence refers to eating bread, but it is not present in the game.
  • There is a giant here. Perhaps he was to be waiting at the top of the giant beanstalk...
  • There is a sword on the floor. Hm, looks like another weapon was planned (perhaps to slay the giant?)
  • Crash! Tinkle! Dear me! There are fragments of your bottle here. Looks like the bottle was intended to be as fragile as the Ming vase.

Tuesday, 6 August 2013

Adventure by Program Power 5: Walk-through Solution

Warning: do not read further unless you wish to see the complete solution for the game.



NO (to answer the question of whether you are a wizard; this is just a tribute to an obscure feature of the classic Colossal Cave adventure game. You then begin on a twisty north south road). SOUTH, GET LAMP, WEST, NORTH, WEST, SOUTH, GET AXE, EAST, EAST, SOUTH, NORTH, OPEN SESAME (the cavern opens), YES (to the question of whether you have a lamp), LIGHT LAMP, NORTH, KILL FROG (the princess runs off), EAST, EAST, EAST, EAST, NORTH, NORTH, GET INGOT (treasure 1), SOUTH, RUB LAMP (transported to Magician's bedroom), WEST, WEST, SOUTH, GET VASE (treasure 2), NORTH, WEST, EXTINGUISH LAMP, HOOT (Owl kills the rat), LIGHT LAMP, IN, GET COIN (treasure 3), OUT, EAST, NORTH, NORTH, WEST, KILL SPIDER (with the axe), SOUTH, GET RUBY (treasure 4), NORTH, NORTH, EAST, EAST, DROP AXE, SOUTH, GET WINE, DRINK WINE (for the empty bottle), NORTH, WEST, SOUTH, RUB LAMP (transported back to black room), WEST, FILL BOTTLE, SOUTH, SOUTH, SOUTH, SOUTH, IN (put treasures in the Left Luggage Office), LEAVE VASE (do not use DROP which smashes the vase), DROP COIN, DROP RUBY, DROP INGOT, GET KEYS, STEAL COIN (thrown into the Dungeon, with keys intact), GET RING (treasure 5), UNLOCK DOOR, DROP KEYS (leave them here for next time), OUT, WATER PLANT (tiny plant grows into a beanstalk), SOUTH, EAST, SOUTH, GET AXE, EAST, GET PRINCESS (hooray!), WEST, WEST, SOUTH, EAST, WEST, GET PEARL (treasure 6), SOUTH, SOUTH, EAST, FILL BOTTLE, WEST, DROP PEARL, STEAL PEARL (get thrown into the Dungeon again, as a shortcut back to the castle), GET KEYS, UNLOCK DOOR, DROP KEYS, OUT, WATER BEANSTALK (grows into a giant beanstalk), DROP BOTTLE, UP, GET DIAMOND (treasure 7), DOWN, SOUTH, EAST, SOUTH, WEST, SOUTH, RUB LAMP (transported back to black room), GET PEARL, WEST, SOUTH, SOUTH, SOUTH, SOUTH, IN, DROP PEARL, DROP RING, DROP DIAMOND, SCORE (Well done - you have achieved your goal of collecting all 7 treasures and rescuing the princess, using minimum turns!).

Finally (with the patched "winnable" version of the game): type DROP PRINCESS to win.

Adventure by Program Power - 4: A Few Fixes & Enhancements

Analyzing the Program Code

Athough the program can be listed quite readily, it still presented a bit of a challenge to dissect as it is written in a heavily obfuscated manner - probably to save memory rather than being intentional - with liberal use of GOTOs, global variables, variables in place of line number destinations and so on. The main program is written in BASIC, with text, location exits and other status information being stored and looked up separately in memory.

Below is a list of minor fixes / enhancements made to the program. The main motivation was to improve the display of the text and to make the game winnable by giving some feedback to the player once the princess is rescued.

Enhancement 1: Fix Loader for BBC Version

The first problem was that the BBC disk image I found online did not work "as is" when run from disk. I was able to get this working using a technique similar to that used in the Electron version, which involved adjusting the loader program to run at a more suitable memory location and tacking on a short assembly language routine to the end of the main program which switches to *TAPE mode (to avoid overwriting game data that is loaded into an area of memory that can be corrupted), sets PAGE appropriately and then runs the program.

Enhancement 2: Fix for Word Wrapping

The game is happy to let words in the location descriptions & other messages break across the end of a line. This was easily remedied by adding a check for the cursor location before printing the next word, and moving down a line if needed.

Enhancement 3: Mixed Case

The game stores all its text in memory in capital letters, and looks up the appropriate word or phrase to print. While printing all in capitals simplifies the program code, it is much easier for the player to have mixed case.

It turned out not to be too complicated to add support for mixed case by adjusting the message printing routine to add the following logic rules:
(1) The first word of every sentence should start with a capital letter.
(2) If a full stop, exclamation mark or colon is found then start the next word with a capital letter.
(3) Otherwise print in lower case.

Original text display: words are all-caps and break across lines

Easier to read: word wrapping and mixed case

Enhancement 4: Adjust Check for Dropping the Princess

One puzzle/frustration in the game is that the princess will "run off into the dark" if she is dropped in any location, whereupon she is moved back to the white tower. However the game does not differentiate between locations, leading to the bizarre situation of her running back into the caverns (presumably through the closed cavern entrance) even if dropped outside at the Left Luggage Office!

To remedy this I added a small check so that she only runs off if the location is a dark one (i.e. one that requires your lamp to be lit). This feels more in keeping with the intention of the message. This means that she can be dropped without running off once you are outside the caverns, or in a location that is not considered to be dark.

Enhancement 5: More Informative SCORE

The player's score is linked both to the number of turns taken (which decreases the score) and the number of treasures found (which increases the score). To help track their contribution to the score, and to provide some feedback on progress with the treasure hunt, SCORE now shows the number of turns taken and the number of treasures found so far.
Extended SCORE information: turns & treasures found

Enhancement 6: Making the Game Winnable

Finally, the original game logic does not contain any logic to check if the player has succeeded in bringing back the Princess, leaving the player feeling unsatisfied. After considering what would be an appropriate condition for winning, I enhanced the logic to print a successful end-of-game message on DROPping the princess in the Left Luggage Office (to be consistent with the location where you drop the treasures).