Live data from Hacker News

Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

alex.nisnevich.com

1–10 of 246 posts

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#5
You should reinit the map though, otherwise doing this on level 2 causes funny bugs (and makes the game rather easy ;)

    maze.create = function() {};
    var tmp = map.placeObject;
    map.placeObject = function(x, y, t) {
    	if(t == 'exit') tmp(x,y,t);
    };

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#8
post #5

You should reinit the map though, otherwise doing this on level 2 causes funny bugs (and makes the game rather easy ;) maze.create = function() {}; var tmp = map.placeObject; map.placeObject = function(x, y, t) { if(t == 'exit') tmp(x,y,t); };

level 2 can be solved by using the two "unlocked" lines to comment out the whole maze.create call, too.

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#9

I broke level 4. Is there an obvious way that I am missing to reset at the level you're on when the reset functionality provided under the text editor is insufficient?

The Reset button should completely reset editor state for the level. What happened?

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#10
This worked for the whole first chapter for me (and has some obvious further applications):

    startLevel["constructor"]("m",
    "console.log(m);" +
    "var old = m.placeObject;\n" +
    "m.placeObject = function(x,y,t) { \n" +
    "console.log(t);\n" +
    "if (t === 'exit' || t === 'computer') {\n" +
    "console.log('adding' + t);\n" +
    "return old['ca' + 'll'](m, x,y,t) }};")(map);
EDIT: I wonder if you could wrap the user's code in, e.g. https://code.google.com/p/es-lab/wiki/SecureEcmaScript, and use this to gamify finding bugs in that sandbox :-)
Post reply on HN