How to change the teleporters to only teleport to each other?

In Level 17, how can I set the teleports to only teleport to other safe zones? Since the teleporters change every time you set the map, this is the only thing I can think of.

enter image description here


There are several things you can do here. You've got a bunch of information about the teleporters and traps at your disposal. You could do something that exposes the links that have been created, or you could override those links.

Additional hints, protected by spoiler space:

The previous level shows you how to draw lines on the canvas, so you could draw lines to represent the connections this loop is creating. I think this is what the title of the level ("pointers") is getting at.

Drawing lines for each link is kind of overly verbose, so you might want to check the type and only show the links that are between teleporters.

If you can expose all the teleporter-to-teleporter links, there's a chance you can make it to the bottom right, but it's hard to see the lines and kind of a crapshoot as to whether or not the teleporters actually connect.

Since you know where all the teleporters are (getCanvasCoords), can't you find the fastest route? You want to go from the extreme upper left to the extreme lower right, correct?

What I did was hijack the loop in the code, and use it to find the upper left teleporter and connect it to the lower right one directly, then break out of the loop before any other connections are made. It's a bit brute force, but it worked: https://gist.github.com/agent86ix/0c1615791c05664c99fb


Just like @agent86, I decided to hijack the loop. My solution is slightly shorter and links all 3 teleporter near the player to the ones near the exit.

var player = map.getPlayer();
var entry = [], exit = [];

for (i = 0; i < teleportersAndTraps.length; i++) {
    var t = teleportersAndTraps[i];
    if (t.getType() == 'teleporter') {
        if (Math.abs(t.getX() - player.getX()) <= 2 &&
            Math.abs(t.getY() - player.getY()) <= 2)
            entry.push(t);
        if (Math.abs(t.getX() - (map.getWidth() - 10)) <= 2 &&
            Math.abs(t.getY() - (map.getHeight() - 5)) <= 2)
            exit.push(t);
    }
}

for (i = 0; i < 3; i++)
    entry[i].setTarget(exit[i]);

break;

Basically, I'm looking for any teleporter that has a x- or y-distance of 2 or less to the player or the exit.