Back to front pageView on Hacker News (opens in a new tab)Show HN: Untrusted, a JavaScript adventure game you play by modifying its source (opens in a new tab)alex.nisnevich.com555 pointsby alnis (on Hacker News)12 years agoComments (235) 72 threadsShow all commentsShowing thread 22 of 72[-]resist_futility12 years ago8 replies#Anybody think of another way to do the robot levels without adding any state?https://gist.github.com/db41e069df7bae142248opnitro12 years ago#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.columbo12 years ago#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 joystickhttp://qiao.github.io/PathFinding.js/visual/You'd just need to recalc the pathfinder each time.xmonkee12 years ago#https://gist.github.com/xmonkee/10099892The 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.galvan12 years ago#https://gist.github.com/anonymous/486caea6cc41f13dca76The robot goes down unless its x-coordinate is between 20 and 33, in which case it goes up. Kinda cheesy, but it works...joshka12 years ago#Follow the player left right, and move mirrored on a line. Works pretty much unmodified for 12 and 13. https://gist.github.com/anonymous/f59ea23c9a421d93c2c1SheeEttin12 years ago#https://gist.github.com/anonymous/12b15e3de9340655ed78Variable to control the direction the robot moves, changed with the function phone.christiangenco12 years ago#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.benvan12 years ago#yeah. I made it follow a cosine path:http://benvan.co.uk/cosine.gif
Show HN: Untrusted, a JavaScript adventure game you play by modifying its source (opens in a new tab)alex.nisnevich.com555 pointsby alnis (on Hacker News)12 years ago
resist_futility12 years ago8 replies#Anybody think of another way to do the robot levels without adding any state?https://gist.github.com/db41e069df7bae142248
opnitro12 years ago#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.
columbo12 years ago#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 joystickhttp://qiao.github.io/PathFinding.js/visual/You'd just need to recalc the pathfinder each time.
xmonkee12 years ago#https://gist.github.com/xmonkee/10099892The 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.
galvan12 years ago#https://gist.github.com/anonymous/486caea6cc41f13dca76The robot goes down unless its x-coordinate is between 20 and 33, in which case it goes up. Kinda cheesy, but it works...
joshka12 years ago#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
SheeEttin12 years ago#https://gist.github.com/anonymous/12b15e3de9340655ed78Variable to control the direction the robot moves, changed with the function phone.
christiangenco12 years ago#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.
Comments (235) 72 threads
Show all comments
Showing thread 22 of 72
https://gist.github.com/db41e069df7bae142248
http://qiao.github.io/PathFinding.js/visual/
You'd just need to recalc the pathfinder each time.
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.
The robot goes down unless its x-coordinate is between 20 and 33, in which case it goes up. Kinda cheesy, but it works...
Variable to control the direction the robot moves, changed with the function phone.
For level 13 I just used:
And regenerated the map until I got to one that could be solved by moving only right and down.http://benvan.co.uk/cosine.gif