Created
September 30, 2017 17:36
-
-
Save anonymous/9db55de41a5ac0bf2d6b8a48a9869ceb to your computer and use it in GitHub Desktop.
Solution to level 15 in Untrusted: http://alex.nisnevich.com/untrusted/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************** | |
* exceptionalCrossing.js * | |
************************** | |
* | |
* Sorry, old friend, but I'm afraid I can't share | |
* co-authorship on this paper. You've done a very | |
* good job getting this Algorithm for me. The bit | |
* with the keys was especially clever! I wouldn't | |
* have thought of it myself. But then, of course, | |
* that's why you were here in the first place. | |
* | |
* You've served your purpose well. But now, alas, | |
* it is time for you to die. | |
* | |
* I'm not heartless, though. In fact, I will let | |
* you choose your mode of death. There, isn't that | |
* nice? | |
*/ | |
function startLevel(map) { | |
map.displayChapter('Chapter 3\nBetrayal'); | |
map.placePlayer(0, 0); | |
// yoink! | |
map.getPlayer().removeItem('theAlgorithm'); | |
map.defineObject('water', { | |
'symbol': '░', | |
'color': '#44f', | |
'onCollision': function (player) { | |
player.killedBy(map.placePlayer()); | |
} | |
}); | |
for (var x = 0; x < map.getWidth(); x++) | |
for (var y = 5; y < 15; y++) | |
map.placeObject(x, y, 'water'); | |
map.placeObject(map.getWidth()-1, map.getHeight()-1, 'exit'); | |
} | |
function validateLevel(map) { | |
map.validateExactlyXManyObjects(1, 'exit'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment