processing

/*
* dungeon_builder
*
* Build a dungeon! Or rather, make the computer do it for you.
* Your assignment here is to complete the buildDungeon function to create a dunegon that connects
* the player’s starting point (playerx, playery) with the dungeon exit point (exitx, exity). Both
* are placed randomly for you, with small rooms around them, so your task is to create some
* rooms/corridors that connect them together, hopefully forming an interesting dungeon.
*
* To help you, the following functions are available:
*
* dput(x,y,tile) — Places tile at the specified coordinates in the dungeon.
* dput(x,y) — Places the default floor tile at the specified coordinates.
* dget(x,y) — Returns the tile at (x,y). If (x,y) are out of bounds then returns EMPTY.
* hline(x1,x2,y), vline(x,y1,y2) — These draw horizontal and vertical lines of floor tiles
* — between the specified coordinates.
* room(x1,y1,x2,y2) — Draws a filled rectangle of floor tiles between (x1,y1)-(x2,y2), inclusive.
*
* Note that you don’t need to worry about adding wall tiles; the system will surround all your floors
* with them after you are finished. The only tiles you need to worry about are
*
* EMPTY — The blackness that fills the dungeon before you create it. Your job is to replace this.
* FLOOR — Floors that your dungeon explorer can move over.
* DOOR — Purely for decoration, acts like a floor in all respects except appearance.
*
* If you want to give yourself a challenge, you can also use
* WALL — The wall tile, if you want to add them manually
* KEY — A key, on the floor, that the player can pick up.
* LOCKED_DOOR — A locked door, only passable if the player has >0 keys, uses up one key.
* TELEPORTER — A teleporter; if you only add one teleporter, it will do nothing. If you have two,
* then stepping on one will teleport you to the other. If you have more than two,
* then stepping on them will rotate you through all the teleporters, in a
* seemingly-random but fixed pattern.
*
* The map is pre-allocated to 513×513 tiles, with (0,0) in the center of the map. The constant
* DUNGEON_SIZE refers to the width/height of the dungeon.
*
* Some things you are NOT allowed to do:
* — Make a giant room that covers the start and exit.
* — Move the start, or the exit.
* — Add a teleporter under the player, and another next to the exit.
*
* Controls while “playing” the game:
* — Arrow keys (or VIM-style hjkl) to move
* — ‘m’ toggles the minimap (you are shown in blue, the exit in red). Note that you can still move
* while the minimap is displayed.
* — You can drag the mouse to scroll your view, although it will snap back to the player when you
* move.
*
* The tiles used are from SLASH’EM (http://slashem.sourceforge.net/), and are released under the
* Nethack General Public License (since they originated with NetHack).
*/