public class World
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
World.Direction |
| Modifier and Type | Field and Description |
|---|---|
private int |
columns |
static int |
MAX_ITERATIONS |
static java.lang.String |
PLAYER_ICON |
static double |
ROOM_REWARD |
private java.util.ArrayList<Room> |
rooms |
private int |
rows |
| Constructor and Description |
|---|
World(int columns,
int rows) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRoom(Room room)
addRoom adds a room to the world.
|
void |
displayRooms()
A non-graphical room display
|
static java.lang.String |
getArrow(World.Direction direction)
getArrow will return the ASCII character for an arrow corresponding to a Direction
|
int |
getColumns()
Standard accessor method
|
static World.Direction |
getRandomDirection()
Gets a random direction
|
Room |
getRoom(int x,
int y)
Returns the room at the designated X and Y coordinates
|
java.util.ArrayList<Room> |
getRooms()
Standard accessor method
|
int |
getRows()
Standard accessor method
|
static boolean |
isValidDirection(java.lang.String s)
A validation function that checks whether a string corresponds to
a value of the Direction enum
|
void |
setColumns(int columns)
Standard mutator method
|
void |
setRooms(java.util.ArrayList<Room> rooms)
Standard mutator method
|
void |
setRows(int rows)
Standard mutator method
|
private int rows
private int columns
private java.util.ArrayList<Room> rooms
public static final int MAX_ITERATIONS
public static final java.lang.String PLAYER_ICON
public static final double ROOM_REWARD
public void addRoom(Room room)
room - public Room getRoom(int x, int y)
x - The X coordinatey - The Y coordinatepublic void displayRooms()
public static boolean isValidDirection(java.lang.String s)
s - The string to be converted into a Direction (enum)public static World.Direction getRandomDirection()
public static java.lang.String getArrow(World.Direction direction)
direction - Any valid value of enum Direction (i.e., UP, DOWN, RIGHT, LEFT)public int getRows()
public void setRows(int rows)
public int getColumns()
public void setColumns(int columns)
public java.util.ArrayList<Room> getRooms()
public void setRooms(java.util.ArrayList<Room> rooms)