deepest end is really deepest
This commit is contained in:
@@ -87,27 +87,6 @@ public class LabyModel implements WallsProvider
|
||||
MazeCreationListener listener = null;
|
||||
|
||||
|
||||
/**
|
||||
TODO
|
||||
private static MyLinkedList<P>
|
||||
{
|
||||
MyLinkedList<P> next;
|
||||
P content
|
||||
|
||||
MyLinkedList<P>( P object)
|
||||
{
|
||||
content=object;
|
||||
next=null;
|
||||
}
|
||||
|
||||
MyLinkedList<P> addLast(P object)
|
||||
{
|
||||
next = new MyLinkedList(object);
|
||||
return next;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public LabyModel(int width, int height, int maxdepth, Random random)
|
||||
{
|
||||
this.width = width;
|
||||
@@ -525,13 +504,16 @@ TODO
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
generate a maze with an entry set at (x,y)
|
||||
**/
|
||||
public void generateWithEntry(int x, int y)
|
||||
{
|
||||
|
||||
openList.add(new Position(x, y));
|
||||
while (!openList.isEmpty())
|
||||
{
|
||||
step(0); // fixme depth not set
|
||||
step();
|
||||
|
||||
synchronized (coherentLock)
|
||||
{
|
||||
@@ -834,10 +816,19 @@ TODO
|
||||
return backpath;
|
||||
}
|
||||
|
||||
private final void closePosition(int x, int y)
|
||||
{
|
||||
t[x][y] &= ~OPEN;
|
||||
t[x][y] |= CLOSED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns wheter process closed current node.
|
||||
* One step in Maze generation process
|
||||
* get last element in open list and explore one random direction with it.
|
||||
*
|
||||
* @returns whether process closed current node.
|
||||
**/
|
||||
public boolean step(int depth)
|
||||
public boolean step()
|
||||
{
|
||||
boolean complete = false;
|
||||
Position current = null;
|
||||
@@ -977,11 +968,12 @@ TODO
|
||||
}
|
||||
}
|
||||
complete = true;
|
||||
t[x][y] &= ~OPEN;
|
||||
t[x][y] |= CLOSED;
|
||||
if (current.getDepth() > deepest)
|
||||
closePosition(x,y);
|
||||
|
||||
final int currentdepth = current.getDepth();
|
||||
if ( currentdepth > deepest)
|
||||
{
|
||||
deepest = depth;
|
||||
deepest = currentdepth;
|
||||
deepestEnd = current;
|
||||
}
|
||||
} // current != null;
|
||||
|
||||
Reference in New Issue
Block a user