Skip to content

Commit

Permalink
add path finder
Browse files Browse the repository at this point in the history
  • Loading branch information
liweinan committed Mar 24, 2013
1 parent ac490f5 commit 4652bb2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/main/java/io/maze/Maze.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void generate() {


System.out.println("LEGEND: C- CANDIDATE, D- DECISION, R- RESULT, G- GO BACK"); System.out.println("LEGEND: C- CANDIDATE, D- DECISION, R- RESULT, G- GO BACK");
while (histories.size() > 0 && visited_cnt < m*n) { while (histories.size() > 0 && visited_cnt < m*n) {

while (currentCell != null) { while (currentCell != null) {
currentCell = nextCell(currentCell); currentCell = nextCell(currentCell);
if (currentCell != null) { if (currentCell != null) {
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/io/maze/cell/CellState.java
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.maze.cell; package io.maze.cell;


import io.maze.cell.Cell;
import io.maze.doors.*;

/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: weli * User: weli
Expand All @@ -14,6 +11,8 @@ public class CellState extends Cell {
private boolean visited = false; private boolean visited = false;
private int x, y; private int x, y;


private boolean inPath = false;

public boolean isVisited() { public boolean isVisited() {
return visited; return visited;
} }
Expand All @@ -37,4 +36,12 @@ public int getY() {
public void setY(int y) { public void setY(int y) {
this.y = y; this.y = y;
} }

public boolean isInPath() {
return inPath;
}

public void setInPath(boolean inPath) {
this.inPath = inPath;
}
} }
15 changes: 15 additions & 0 deletions src/main/java/io/maze/finder/PathFinder.java
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.maze.finder;

import io.maze.Maze;

/**
* Created with IntelliJ IDEA.
* User: weinanli
* Date: 3/24/13
* Time: 1:01 PM
* To change this template use File | Settings | File Templates.
*/
public interface PathFinder {

public void solve(Maze maze);
}

0 comments on commit 4652bb2

Please sign in to comment.