JavaScript Text Based Adventure Game Part 2

So last night I had some time to look at the old code from part 1

and debug…..

I originally thought that my conditional if/else statements weren’t matched up and that it was going to take a long time, but actually it was a really simple error. I had used console.log and I needed to change this to windows.alert all the way through the code (simple find and replace on notebook++) and took about 5 minutes!!


Then came the hard part. I had to play through every single option to make sure it all worked. Now I’m sure it does but it took ages and I was tired so please if you do take the time to try out this game and you get an error, or an unspecified, or something weird happens please let me know so I can fix it!

Here is a link to the modified text based adventure game:

Special thanks to franzcalvo for introducing me to jsfiddle as a program that can run JavaScript code as well as edit them 🙂

Please try out this game and let me know how your adventure ends….please bear in mind some choices are VERY short and some choices are longer. It all depends on the decisions you make!

Have fun and good luck!


  1. How did you manage the different paths? Using decision trees? A moment ago, I learned that Excel is useful to draw them, so I navigated some paths.
    Here is a screen capture of the decision tree:

    If someone wants to continue building the tree with Excel, here is the file:

    I’m now imagining an intelligent agent that through a tree-search algorithm rapidly finds out the shortest path to escape alive …

    Did you hear about the game-playing software that was recently developed at the DeepMind lab?

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s