Live data from Hacker News

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

alex.nisnevich.com

31–40 of 246 posts

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

#31

I wasn't sure how to show all the mines on the minesweeper map, so I just place them all at the top... was this supposed to be the point? :) Anyhoo, nice game, it doesn't matter how you solve it, as it still proves that eval is evil ;)

Ctrl+1 for API docs. There's an API to change the color of a tile :)

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

#32
post #24

Earlier quoted context omitted.

Multiplying the exits is useful ;-)

Heh but then what was the real intention of the earlier maze level? I already multiplied the exit there :) Anyway, really nice work with the game!

Thanks! The intended solution to the maze level was commenting everything out. But of course, all of these have multiple solutions :-)

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

#35
post #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.…

nice!

similarly,

    var oldPlaceObject = map.placeObject;
    var newPlaceObject = function(x, y, type) {
    	if (type !== 'block') {
        	map.placeObject = oldPlaceObject;
        	map.placeObject(x, y, type);
            map.placeObject = newPlaceObject;
        }
    };
    map.placeObject = newPlaceObject;
was my solution to multiple levels ;).

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

#36
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.

thanks for the help ;)

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

#38
I'm not sure what happened with level 4 multiplicity, but I placed a 2nd exit inside the box. Then when I go through it says it completed the level but I'm still on the multiplicity level. Reseting does not fix. https://gist.github.com/anonymous/0dafb64fad2ddd6fd451

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

#39
Very cool! I'm stuck on level 7 because it seems that the script isn't editable anywhere. Related note, the color scheme for highlighting editable lines might want to change, because "black on dark maroone" doesn't exactly jump out.

Love that you're auto-gisting solutions. That was clever - I presume you are browsing through searching for the common description tag? I also like the API popup, although I didn't see it until I got stuck on the (uneditable) level 7. I verified this because $('.editableLines') == [] in console! Perhaps this is a very fancy meta-game that you can only win with a pull request? :)

Post reply on HN