public class SquareCell extends MazeCell { // Code to keep track of how many cells were accessed during the search private boolean accessed = false; private void setAccessed() {accessed=true;} public boolean getAccessed() {return accessed;} public SquareCell(int cellRow, int cellCol, boolean isStart, boolean isExit, boolean northWall, boolean eastWall, boolean southWall, boolean westWall) { walls = new boolean[] {northWall, eastWall, southWall, westWall}; numWalls = 0; for(int i=0; i < 4; i++) { if(walls[i]) { numWalls++; } } isStartCell = isStart; isExitCell = isExit; row = cellRow; col = cellCol; } public boolean isStart() { setAccessed(); return isStartCell; } public boolean isExit() { setAccessed(); return isExitCell; } public String toString() { return "(" + row + "," + col + ")"; } public boolean isWall(Direction d) { setAccessed(); return walls[d.toInt()]; } public int getNumWalls() { setAccessed(); return numWalls; } public int getMaxNumWalls() { return 4; } public int getRow() { setAccessed(); return row; } public int getCol() { setAccessed(); return col; } private boolean[] walls; private int numWalls; private boolean isStartCell; private boolean isExitCell; private int row; private int col; }