News for hackers. Stuff that matters.
Re:Show HN: Untrusted, a JavaScript adventure game you play ... by resist_futility on Monday April 07, 2014 @09:51PM (#7550969)
Anybody think of another way to do the robot levels without adding any state?

https://gist.github.com/db41e069df7bae142248

Re:Show HN: Untrusted, a JavaScript adventure game you play ... by SheeEttin on Tuesday April 08, 2014 @12:14PM (#7554298)
https://gist.github.com/anonymous/12b15e3de9340655ed78

Variable to control the direction the robot moves, changed with the function phone.

Re:Show HN: Untrusted, a JavaScript adventure game you play ... by christiangenco on Tuesday April 08, 2014 @02:05PM (#7554968)
This was mine:

    var r = Math.random();
    me.move(
      r < 0.4 ? 'right' :
        r<0.6 ? 'up' :
          r < 0.8 ? 'down' :
            'left'
    );
Works eventually :)

For level 13 I just used:

    me.move(Math.random() > 0.5 ? 'right' : 'down');
And regenerated the map until I got to one that could be solved by moving only right and down.
Re:Show HN: Untrusted, a JavaScript adventure game you play ... by columbo on Monday April 07, 2014 @10:47PM (#7551168)
I _was_ going to build a pathfinder since it's a well documented process, but it was more work than just making the player a joystick

http://qiao.github.io/PathFinding.js/visual/

You'd just need to recalc the pathfinder each time.

Re:Show HN: Untrusted, a JavaScript adventure game you play ... by xmonkee on Tuesday April 08, 2014 @03:41AM (#7551951)
https://gist.github.com/xmonkee/10099892

The robot follows my player, unless it's green, in which case it goes 'down' (cause it wont pick up the key under remote control for some reason). I'm saving state in the color of the player.

Re:Show HN: Untrusted, a JavaScript adventure game you play ... by galvan on Tuesday April 08, 2014 @03:45AM (#7551971)
https://gist.github.com/anonymous/486caea6cc41f13dca76

The robot goes down unless its x-coordinate is between 20 and 33, in which case it goes up. Kinda cheesy, but it works...

Re:Show HN: Untrusted, a JavaScript adventure game you play ... by joshka on Tuesday April 08, 2014 @11:36AM (#7554024)
Follow the player left right, and move mirrored on a line. Works pretty much unmodified for 12 and 13. https://gist.github.com/anonymous/f59ea23c9a421d93c2c1
Re:Show HN: Untrusted, a JavaScript adventure game you play ... by opnitro on Monday April 07, 2014 @10:13PM (#7551047)
Yeah, I just built a wall that it got stuck behind, then I could run to the door before it got me. Don't have the code sorry.
Re:Show HN: Untrusted, a JavaScript adventure game you play ... by benvan on Saturday April 12, 2014 @09:26AM (#7577773)
yeah. I made it follow a cosine path:

http://benvan.co.uk/cosine.gif