245 comments

[ 2.4 ms ] story [ 240 ms ] thread
You had me at "The continuing adventures of Dr. Eval"
I really like that it has WASD/Arrow/Vim controls. Props.
Content note: plays sound.

Did the quick ^W at work :|

The tab only plays sound while active here, a nice touch I think.
Clicking the sound symbol does mute it, fyi.
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.
That's kinda the point, though. Read the comments for that file. ;)
thanks for the help ;)
you don't need 2 lines, you only need the one below to overwrite the map function, and leave an open dot :D

map.placeObject(7,4,'exit');var a = {map: {placeObject:function(){}}};a.

Related: things like these do not work, because of implementation.

    if (false) // <- inserted by me
    for (var ...) { // <- existing code
        ...code...
    }
Too bad, because extra `for`s could be fun...
If you reload the game, the map should now re-init on every level.

PS. I'm really enjoying all the creative solutions you guys are coming up with!

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?
Btw, I should have said first that I love this game idea and myself and my coworkers have been playing it a bit for the last 20 minutes or so.

I broke my game by reassigning the getWidth method to return an invalid value:

map.getWidth = function() { return 1; }

The approach worked with a valid value: ( map.getWidth = function() { return 6; } ) and I beat the level, but I had to replay the previous 3 levels.

Some suggestions (Again, we loved the game!) - Provide some interface to conveniently index all the solution Gists. - Provide some way to quickly skip to last level played.

Other thoughts: - Enjoyed the look, feel, and user interaction. - The music was great. - I will keep playing this game. :)

Oh, quick note - you can skip to the last level played in the Menu (Ctrl-0). We should probably make that more obvious.
Ah - I see what menu does now. I love this game and have uncovered a few broken game states. This mainly happens when I reassign one of the API methods. Are you interested in user-submitted issues? Let me know; I could email them to you or log them on your GH; whatever is convenient.
User-submitted issues would be great! Logging them on GitHub would be the most convenient.
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 :-)
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 ;).
I also had to overwrite the map.verifyXitems (or whatever it was) to return true regardless.
This is fun. But I have one wish. Overwrite console.log() so it logs onto the website and I don't need to open firebug :)

Edit: I think I solved lvl two to four all the same way. Not sure if that's intended. But I also don't want to spoil it for others.

Edit 2: This worked again at lvl 6, so I'll assume that's a bug. Click this pastebin for spoilers: http://pastebin.com/yfhDhE7P

Good catch! We haven't been checking yet for tampering with functions, but we probably should. Don't think of it as a bug so much as a cheatcode you discovered :-)
Aww, I thought that was to easy. That trick works for basically any level.

Also, is there a good way to completly prevent tampering with functions, or is this just going to be an arms race?

Don't use the functions from the map object, but keep a separate function reference for validation?

I mean if you want to cheat you always can. But that's not the point. Right now you can cheat using official apis.

Just use map._blah() for internal use

By the way: Same trick works for keys.

Object.defineProperty with 'writable' = false?
> Also, is there a good way to completly prevent tampering with functions, or is this just going to be an arms race?

Let's hope for an arms race - it will be far more fun and educating at the same time.

hmm a multi player javascript API tampering arms race game would be pretty awesome too.
I just added a feature to the game that watches certain functions and compares them to what they were at the start of the game (during the level validation phase). I'm sure this can still be gamed though.
First of all, this is absolutely impressive in concept.

Yes, it's too easy that way:

    map.pO = map.placeObject;
    map.placeObject = function(x, y, w){
        return map.pO(x, y, w=='block'?'empty':w);
    }
Does not even need call. But while you cannot protect from `Function['p'+'rototype']['c'+'all']`, I think using `defineProperty` to stop mucking with the code would go a long way into preventing blatant cheating at little cost. That or enclosed reference funcs.

Btw, you trust the level increment counter before succeeding in loading the level. Right now calls are 503ing, so basically I'm [gisting bogus solutions](https://gist.github.com/anonymous/f1b06d63848d6d013e26) but it's also saving those bogus level ups in localstorage...

Does firebug override the ctrl+shift+K javascript console?, curious because I don't use it.
(comment deleted)
Also, you can use String.fromCharCode(95) to write a '_' so that you can access the methods on map that start with an underscore
> "If you can read this, you are cheating! D:"

Loaded the site, popped open the Chrome Dev Tools, and was thoroughly disappointed.

Why were you disappointed?
Well, the title says you play the game by modifying the game's source. Turns out you don't modify the game's source, you modify specific snippets of code that are provided on the page.

Last weekend I hacked around in the source of various online games, I anticipated this to be a similar experience but was disappointed to find that we weren't supposed to actually change the game's source.

Well you can play it that way too, if you want. Try overriding some of the internal functions using creative methods. :)
I tried to move the exit inside the walls. I was unable to edit any of the code. I thought that was the point?
Ctrl+5 to reload the level after you changed it. Did you do that? On one of the levels I created a new exit inside, and it worked.
Borks at level 7, upon touching phone with undebuggable message on canvas:

  d up the function p 1, found:oad the level
  Wone! number of exits ...
Bizarre! I haven't been able to reproduce it. Can you share your code for that level (if it's been modified at all)?
Alnis, love the game! But I also ran into unexpected behavior after clearing level 7 (change your color). It kept reloading the same level, but opening up new levels in Level select. Even so, clicking on higher levels keeps reloading the same colors.js screen.

Another weird thing I noticed was that next to the computer and telephone in the inventory, two letters "k" appeared. I'm using Firefox 28 on Windows 7.

Here's the solution I used for colors.js https://gist.github.com/anonymous/ab5cd3b393c290fbf8c1

This might be tied to the issue that mandlar, pokpokpok, and valgaze have been having, but I haven't been able to reproduce it yet.

Does resetting these levels (Ctrl-4) help at all?

Yes, Ctrl-4 does work, thanks for the tip!
I'm not sure what the real intention of the level "Multiplicity" was, but just placing an exit anywhere you want works just as well!
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 :-)
stupid drones, me.selfDestruct (tableflip)
I made a wall to circle around the drone. Pretty fun.
I found it easier to make myself invincible.

map.getPlayer().killedBy = function() {};

Drone just follows you around like harmless puppy.

https://gist.github.com/anonymous/dfb6822e683ea7418ea8

Neo: What are you trying to tell me? That I can dodge bullets? Morpheus: No, Neo. I'm trying to tell you that when you're ready, you won't have to. :)
I did the exact same thing.
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 :)
Pretty cool game bud, I actually think this is a superior environment for learning to program than many of the richer 3-d interfaces I've seen.
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
this happened to me, but i went through the exit again and this time it worked
A few people have reported a similar bug. I don't think that it's level specific but has something to do with the next level not leading correctly upon completing a level.

We're still not sure why it happens or when (it seems to only affect a few people), but we'll try to figure it out.

There aren't any errors you can see in the JavaScript console, are there?

It happened twice to me, once on 4 once on 8 I think. Both times it happened when I went through the exit then went back to it.
same here, putting another exit on the canvas breaks things in a weird way
valgaze: your comment is not visible unless a user has showdead turned on.
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? :)

Thanks!

Does your level 7 not look like http://i.imgur.com/AFTxPWC.png ?

He means level 8, I think. Or at least I have the same problem with level 8 (intoTheWoods)
Oh, there's a small bit of editable text at the bottom of level 8 (line 100). Sorry if it's not very clear - we may work on the color scheme a little.
This took me a bit as well but there is a small bit that is editable, but I agree that it isn't clearly defined, especially when it's only a few characters and not an entire line.

Hint: Phone functions

Very fun. I found a bug that lets me skip levels 8-11 by using this code in the phone callback on level 7:

  if ( ! ( player.cc && player.cc.length ) ) {
       player.cc = ['#f00', '#ff0', '#0f0'];
  }
  player.setColor(player.cc.shift());
It says it's loading the next level, but the code and gamefield remain stuck on level 7 until you push it to level 12.
We're glad you like it!

No clue why that's happening, but we'll continue to investigate.

Ooh, shift, nice. Didn't know about that. That should come in handy.
Is there an easy way to transfer progress between computers? (other than saving your solution Gists?)
Using CTRL+Q for the phone is dangerous on a mac, as it's easily confused with APPLE+Q which closes the browser window, losing your progress.

---

Edit: it saves the game state in localstorage; kudos!

At the top left, in 'Chrome', there's a useful 'Warn before Quitting' option.
Can anyone give me a hint for level 12?
You're defining a robot's properties, so you might want to define its properties. That'll open the door to higher-level navigation logic.

(Being obtuse is difficult...)

I made the robot follow a cosine curve. Cute but ridiculous solution.
wow that level took me forever. Ended up using things along the lines of if( me.getX() < 15) {move down then right} elst if me.getX()>15 and < 30 {move up then right} etc.
You could always implement a-star, a searching algorithm.
You could create your own robot control system based on pressure plates as well
I personally wired the bot to track and follow my movements. Then I just walked the bot through the maze.
What if the triangular walls were straight?
I encoded a route.

    moves = [['down', 5], ['right', 20], ['up', 1] /* and so on */]
map.getPlayer()['hasItem'] = function yes () { return true; };

    map.validateExactlyXManyObjects = function() {};
lets you put an exit tile next to your character on every level
I'm really surprised that we never thought of that. We'll try to prevent this exploit soon :-)
This is fun! But I've run into a problem. Advancement past level 14 seems to be bugged; upon completion, the keys in my inventory were replaced with a capital A which I assume to represent the algorithm, but then level 14 reloaded with a message at the bottom saying "You have lost the Algorithm!" Re-completing the level works, but the same thing happens, as many times as I like; the last time, I saw "run 17_pointers.jsx" scroll past, but still got the map and code for level 14.

My solution to level 14 [1] involved a state variable on the me object; could that have broken something?

[1] https://gist.github.com/anonymous/8e4f11c26e5e6fe3d7d6

This seems to be tied to a bug some other people have experienced where new levels don't load correctly and are overwritten with existing levels.

Try going to level 15 and resetting the level (Ctrl-4). Does that help at all?

It does! Thanks, and thanks for a fun, engrossing diversion on a rainy Monday afternoon.

(Update: Each time I enter a level, it loads as level 13, and I have to reset it to get the correct map and code -- just a heads-up in case it helps with debugging. Chrome 33.something, Windows 7 x64.)

Very fun, however once I reached the level with the DOM, I catched the opponent but the game went crazy and submitted a lot of queries to Gist (when I closed the tab, the counter was at 64, and Github was serving 403).