Skip to content

Instantly share code, notes, and snippets.

@Untrusted-Game
Created July 1, 2022 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Untrusted-Game/db74bcda84a05c89342b0dc0f6f7d1a5 to your computer and use it in GitHub Desktop.
Save Untrusted-Game/db74bcda84a05c89342b0dc0f6f7d1a5 to your computer and use it in GitHub Desktop.
Solution to level 4 in Untrusted: http://alex.nisnevich.com/untrusted/
/*******************
* multiplicity.js *
*******************
*
* Out of one cell and into another. They're not giving you
* very much to work with here, either. Ah, well.
*
* Level filenames can be hints, by the way. Have I
* mentioned that before?
*
* No more cells after this one. I promise.
*/
function startLevel(map) {
map.placePlayer(map.getWidth()-5, map.getHeight()-4);
for (var y = 7; y <= map.getHeight() - 3; y++) {
map.placeObject(7, y, 'block');
map.placeObject(map.getWidth() - 3, y, 'block');
}
map.placeObject(map.getWidth() -8, 9, 'exit')
for (var x = 7; x <= map.getWidth() - 3; x++) {
map.placeObject(x, 7, 'block');
map.placeObject(x, map.getHeight() - 3, 'block');
}
map.placeObject(map.getWidth() - 5, 5, 'exit');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment