Arqade is a question and answer site for passionate videogamers on all platforms. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In level 6 of Untrusted, how do I avoid the attack drone? I've tried creating a new object type that could act as a blocker, but the drone manages to get around it, and I'm convinced there has to be an easier solution that I'm just not seeing.

share|improve this question
up vote 5 down vote accepted

The drone has a very simple "AI" that chooses moves in a dumb way, so you can exploit that to trap it.

It checks to see which direction is the closest and commits to that prior to determining whether or not a move in that direction is valid. Thus, you can make it so that moves that get it close to you by those standards are consistently invalid, and it won't catch up to you in time.

The way I exploited this was:

I created a little "cage" out of blocks that I knew the drone would prefer to move into. That way, I could move past it and it wouldn't catch me.

The full solution I used was:

map.placeObject(map.getWidth()-3, 10, 'block'); map.placeObject(map.getWidth()-4, 10, 'block'); map.placeObject(map.getWidth()-5, 11, 'block'); map.placeObject(map.getWidth()-4, 12, 'block');

share|improve this answer
It also doe not have validation for only 1 player, so map.placeObject(map.getWidth()-5, 11, 'player'); gives it a different target to attack. – Batophobia Apr 9 '14 at 19:36

You can actually rebind the moveToward variable, and the re-bound function will be used by the drone. This allows you to trivially reprogram the drone to do movement you want.

share|improve this answer

or you can build self defences drones :)

map.defineObject('selfDefenceDrone', {
'type': 'dynamic',
'symbol': 'X',
'color': 'green',
'onCollision': function (player) {
player.killedBy('an attack drone');
'behavior': function (me) {
moveToward(me, 'attackDrone');

map.placeObject(map.getWidth()-9, 12, 'selfDefenceDrone');
map.placeObject(map.getWidth()-5, 16, 'selfDefenceDrone');
map.placeObject(map.getWidth()-5, 8, 'selfDefenceDrone');
map.placeObject(map.getWidth()-1, 14, 'selfDefenceDrone');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.