Skip to content
Browse files

cleanup

  • Loading branch information...
1 parent 6406f0a commit ccdd3036e066df8b0a7d35675bb1dc969f681bb2 @liweinan committed Mar 24, 2013
View
25 README.md
@@ -92,3 +92,28 @@ Result:
| | | | V |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ +
+
+From the log you can see how the maze is generated:
+
+ LEGEND: C- CANDIDATE, D- DECISION, R- RESULT, G- GO BACK
+ (C- DOWN;RIGHT;)(D- go RIGHT)(R- x:1 y:0)
+ (C- DOWN;RIGHT;)(D- go DOWN)(R- x:1 y:1)
+ (C- DOWN;LEFT;RIGHT;)(D- go RIGHT)(R- x:2 y:1)
+ (C- DOWN;UP;)(D- go DOWN)(R- x:2 y:2)
+ (C- LEFT;)(D- go LEFT)(R- x:1 y:2)
+ (C- LEFT;)(D- go LEFT)(R- x:0 y:2)
+ (C- UP;)(D- go UP)(R- x:0 y:1)
+ (G- x:0 y:1)
+ (G- x:0 y:2)
+ (G- x:1 y:2)
+ (G- x:2 y:2)
+ (G- x:2 y:1)
+ (C- UP;)(D- go UP)(R- x:2 y:0)
+ (G- x:2 y:0)
+ +---+---+---+
+ > | |
+ +---+ + +
+ | | |
+ + +---+ +
+ | V |
+ +---+---+ +
View
8 src/main/java/io/maze/Maze.java
@@ -108,17 +108,9 @@ public Direction getDirection() {
return direction;
}
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
public CellState getCell() {
return cell;
}
-
- public void setCell(CellState cell) {
- this.cell = cell;
- }
}
private Selection selectNext(HashMap<Direction, CellState> candidates) {
View
2 src/main/java/io/maze/PlayMaze.java
@@ -13,7 +13,7 @@
public class PlayMaze {
public static final void main(String[] args) {
- Maze maze = MazeFactory.createMaze(28, 28);
+ Maze maze = MazeFactory.createMaze(3, 3);
maze.print();
}
}
View
16 src/main/java/io/maze/cell/Cell.java
@@ -23,31 +23,15 @@ public NorthDoor getNorthDoor() {
return northDoor;
}
- public void setNorthDoor(NorthDoor northDoor) {
- this.northDoor = northDoor;
- }
-
public EastDoor getEastDoor() {
return eastDoor;
}
- public void setEastDoor(EastDoor eastDoor) {
- this.eastDoor = eastDoor;
- }
-
public SouthDoor getSouthDoor() {
return southDoor;
}
- public void setSouthDoor(SouthDoor southDoor) {
- this.southDoor = southDoor;
- }
-
public WestDoor getWestDoor() {
return westDoor;
}
-
- public void setWestDoor(WestDoor westDoor) {
- this.westDoor = westDoor;
- }
}
View
17 src/main/java/io/maze/cell/CellState.java
@@ -11,30 +11,13 @@
* To change this template use File | Settings | File Templates.
*/
public class CellState extends Cell {
- public static final Door[] DOORS = {new NorthDoor(), new EastDoor(), new SouthDoor(), new WestDoor()};
private boolean visited = false;
private int x, y;
public boolean isVisited() {
return visited;
}
- public Door selectDoor(Door door) {
- if (door.getClass().equals(NorthDoor.class)) {
- return this.getNorthDoor();
- }
- if (door.getClass().equals(SouthDoor.class)) {
- return this.getNorthDoor();
- }
- if (door.getClass().equals(EastDoor.class)) {
- return this.getEastDoor();
- }
- if (door.getClass().equals(WestDoor.class)) {
- return this.getWestDoor();
- }
- return null;
- }
-
public void setVisited(boolean visited) {
this.visited = visited;
}

0 comments on commit ccdd303

Please sign in to comment.
Something went wrong with that request. Please try again.