-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMazeSquare.java
More file actions
108 lines (97 loc) · 2.04 KB
/
MazeSquare.java
File metadata and controls
108 lines (97 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* MazeSquare.java
* A helper class for maze solving assignment.
* Represents a single square within a rectangular maze.
*
* @author Alvin Bierley
* @author Chris Kitchen
*/
public class MazeSquare
{
private boolean visited;
private int r, c;
private boolean top, bottom, left, right, start, finish;
/**
* constructor for the MazeSquare class
*/
public MazeSquare(int r, int c, boolean top, boolean bottom, boolean left, boolean right, boolean start, boolean finish)
{
this.visited = false;
this.r = r;
this.c = c;
this.top = top;
this.bottom = bottom;
this.left = left;
this.right = right;
this.start = start;
this.finish = finish;
}
/**
* returns visited information of a MazeSquare
*/
public boolean isVisited() {
return visited;
}
/**
* marks a MazeSquare as visited
*/
public void visit() {
visited = true;
}
/**
* returns the row for the square
*/
public int getR()
{
return r;
}
/**
* returns the column of the square
*/
public int getC()
{
return c;
}
/**
* returns true or false for if there is a top wall
*/
public boolean hasTopWall()
{
return top;
}
/**
* returns true or false for if there is a bottom wall
*/
public boolean hasBottomWall()
{
return bottom;
}
/**
* returns true or false for if there is a left wall
*/
public boolean hasLeftWall()
{
return left;
}
/**
* returns true or false for if there is a right wall
*/
public boolean hasRightWall()
{
return right;
}
/**
* returns true or false for if the square is a start square
*/
public boolean start()
{
return start;
}
/**
* returns true or false for if the square is a finish square
*/
public boolean finish()
{
return finish;
}
}