package core; import tileengine.TERenderer; import tileengine.TETile; public class Main { public static final int WIDTH = 80; public static final int HEIGHT = 30; public static void main(String[] args) { TERenderer ter = new TERenderer(); ter.initialize(WIDTH, HEIGHT); // Seed for reproducibility long seed = System.currentTimeMillis(); World world = new World(seed); // Fill the world with rooms and hallways world.fillWorld(); // Render the world to the screen ter.renderFrame(world.getWorldTiles()); } // build your own world! ughhhh } package core; import tileengine.TETile; import tileengine.Tileset; public class AutograderBuddy { /** * Simulates a game, but doesn't render anything or call any StdDraw * methods. Instead, returns the world that would result if the input string * had been typed on the keyboard. * * Recall that strings ending in ":q" should cause the game to quit and * save. To "quit" in this method, save the game to a file, then just return * the TETile[][]. Do not call System.exit(0) in this method. * * @param input the input string to feed to your program * @return the 2D TETile[][] representing the state of the world */ public static TETile[][] getWorldFromInput(String input) { long seed = parseSeed(input); World world = new World(seed); world.fillWorld(); return world.getWorldTiles(); } private static long parseSeed(String input) { if (input.matches("N\\d+S")) { String seed = input.substring(1, input.length() - 1); try { return Long.parseLong(seed); } catch (NumberFormatException e) { return 26478; } } throw new IllegalArgumentException(); } /** * Used to tell the autograder which tiles are the floor/ground (including * any lights/items resting on the ground). Change this * method if you add additional tiles. */ public static boolean isGroundTile(TETile t) { return t.character() == Tileset.FLOOR.character() || t.character() == Tileset.AVATAR.character() || t.character() == Tileset.FLOWER.character(); } /** * Used to tell the autograder while tiles are the walls/boundaries. Change * this method if you add additional tiles. */ public static boolean isBoundaryTile(TETile t) { return t.character() == Tileset.WALL.character() || t.character() == Tileset.LOCKED_DOOR.character() || t.character() == Tileset.UNLOCKED_DOOR.character(); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter