JavaScript Text Based Adventure Game Part 2

So last night I had some time to look at the old code from part 1 https://ashbotandsparki.wordpress.com/2015/06/14/javascript-text-based-adventure-game-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!!

Untitled2

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:

https://jsfiddle.net/3nsxbaff/1/

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!

Advertisements

4 thoughts on “JavaScript Text Based Adventure Game Part 2

  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:
    https://franzcalvo.files.wordpress.com/2015/06/decision_tree_game.xlsx

    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?
    http://www.nature.com/news/game-playing-software-holds-lessons-for-neuroscience-1.16979

    Liked by 1 person

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s