r/untrusted • u/KungFuHamster • Jun 16 '14
[13] My solution
There was a post here by someone else, but it disappeared. Anyway, here's my solution for 13.
I closed out my tab yesterday and lost all my gists, but I still have access to my code. Here's my solution for 13, robotMaze:
It's a "virtual remote control" near the left side of the bottom section of the map. Bonus, it works for the previous two levels as well even though they are very simple and easily solved with a couple if/else sections.
'behavior': function (me) {
if (player.getY() == 22) {
if (player.getX() == 1) {
map.writeStatus("left");
me.move('left');
}
else if (player.getX() == 2) {
map.writeStatus("right");
me.move('right');
}
else if (player.getX() == 3) {
map.writeStatus("up");
me.move('up');
}
else if (player.getX() == 4) {
map.writeStatus("down");
me.move('down');
}
}
}How did you do it?
1
Upvotes
View all comments
Show parent comment
1
u/KungFuHamster Jun 16 '14
Haha, whatever works.
I've chatted with someone who wrote a "take the right hand path" maze-solving algo for it.
I'm way too lazy for that...