deepest end is really deepest
This commit is contained in:
3
README
3
README
@@ -3,7 +3,8 @@ This is a personal project to generate a 2D maze using in depth path generation.
|
||||
|
||||
Download the 'latest' laby.zip containing java jar from my blog http://blog.artisanlogiciel.net/public/tech/laby.zip
|
||||
|
||||
this can generate a stl file, overall goal was to print it with a 3D printer, i didn't test it yet ( even if i actualy have a 3D printer ).
|
||||
this can generate a stl file, overall goal was to print it with a 3D printer.
|
||||
After years i finaly printed one maze, find it at https://www.thingiverse.com/thing:2814655
|
||||
|
||||
This is the very first usable part.
|
||||
It was developped under debian 7/8 but since it is java based it might be very easily recompiled or even just copied on other platform.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<project name="artloglaby" default="dist" basedir="/home/plhardy/artisanlogiciel/code/laby_github">
|
||||
<project name="artloglaby" default="dist" basedir="/home/plhardy/artisanlogiciel/code/laby">
|
||||
<description>
|
||||
simple example build file
|
||||
</description>
|
||||
|
||||
@@ -11,8 +11,8 @@ $(OUT):
|
||||
# mkdir -p $(OUT)
|
||||
|
||||
clean:
|
||||
@find $(PACKAGE_DIR) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null && echo "cleaned classes in source"
|
||||
@find $(OUT) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null || echo "nothing to clean"
|
||||
@find $(PACKAGE_DIR) -name "*.class" -type f -print0|xargs -0 --no-run-if-empty rm 2>/dev/null
|
||||
@find $(OUT) -name "*.class" -type f -print0|xargs -0 --no-run-if-empty rm 2>/dev/null
|
||||
|
||||
test:
|
||||
echo "$(pwd)/$(PACKAGE_DIR)"
|
||||
|
||||
@@ -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