public class Maze
extends java.lang.Object
Constructor and Description |
---|
Maze(int nbr)
Creates a maze with number nbr.
|
Maze(java.lang.String filename,
int xEntry,
int yEntry)
Creates a maze based on an image file (.png or .jpg).
|
Modifier and Type | Method and Description |
---|---|
boolean |
atExit(int x,
int y)
Checks if the point x,y is at (or near) the exit.
|
void |
draw(SimpleWindow w)
Draws the maze in a window.
|
int |
getXEntry()
Returns the x coordinate of the entry point.
|
int |
getYEntry()
Returns the y coordinate of the entry point.
|
boolean |
wallAtLeft(int direction,
int x,
int y)
Check if you, when you're in x,y and heading in a given direction, have a
wall directly to the left.
|
boolean |
wallInFront(int direction,
int x,
int y)
Check if you, when you're in x,y and heading in a given direction, have a
wall directly in front.
|
public Maze(int nbr)
nbr
- the number of the mazepublic Maze(java.lang.String filename, int xEntry, int yEntry)
filename
- name of image filexEntry
- x coordinate of the maze's entry pointyEntry
- y coordinate of the maze's entry pointpublic void draw(SimpleWindow w)
w
- the SimpleWindow to draw inpublic int getXEntry()
public int getYEntry()
public boolean atExit(int x, int y)
x
- the x coordinatey
- the y coordinatepublic boolean wallAtLeft(int direction, int x, int y)
direction
- the direction (0, 90, 180, 270 degrees)x
- the x coordinatey
- the y coordinatepublic boolean wallInFront(int direction, int x, int y)
direction
- the direction (0, 90, 180, 270 degrees)x
- the x coordinatey
- the y coordinate