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
|
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.
|
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.
|
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>
|
<description>
|
||||||
simple example build file
|
simple example build file
|
||||||
</description>
|
</description>
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ $(OUT):
|
|||||||
# mkdir -p $(OUT)
|
# mkdir -p $(OUT)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@find $(PACKAGE_DIR) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null && echo "cleaned classes in source"
|
@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 rm 2>/dev/null || echo "nothing to clean"
|
@find $(OUT) -name "*.class" -type f -print0|xargs -0 --no-run-if-empty rm 2>/dev/null
|
||||||
|
|
||||||
test:
|
test:
|
||||||
echo "$(pwd)/$(PACKAGE_DIR)"
|
echo "$(pwd)/$(PACKAGE_DIR)"
|
||||||
|
|||||||
@@ -87,27 +87,6 @@ public class LabyModel implements WallsProvider
|
|||||||
MazeCreationListener listener = null;
|
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)
|
public LabyModel(int width, int height, int maxdepth, Random random)
|
||||||
{
|
{
|
||||||
this.width = width;
|
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)
|
public void generateWithEntry(int x, int y)
|
||||||
{
|
{
|
||||||
|
|
||||||
openList.add(new Position(x, y));
|
openList.add(new Position(x, y));
|
||||||
while (!openList.isEmpty())
|
while (!openList.isEmpty())
|
||||||
{
|
{
|
||||||
step(0); // fixme depth not set
|
step();
|
||||||
|
|
||||||
synchronized (coherentLock)
|
synchronized (coherentLock)
|
||||||
{
|
{
|
||||||
@@ -834,10 +816,19 @@ TODO
|
|||||||
return backpath;
|
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;
|
boolean complete = false;
|
||||||
Position current = null;
|
Position current = null;
|
||||||
@@ -977,11 +968,12 @@ TODO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
complete = true;
|
complete = true;
|
||||||
t[x][y] &= ~OPEN;
|
closePosition(x,y);
|
||||||
t[x][y] |= CLOSED;
|
|
||||||
if (current.getDepth() > deepest)
|
final int currentdepth = current.getDepth();
|
||||||
|
if ( currentdepth > deepest)
|
||||||
{
|
{
|
||||||
deepest = depth;
|
deepest = currentdepth;
|
||||||
deepestEnd = current;
|
deepestEnd = current;
|
||||||
}
|
}
|
||||||
} // current != null;
|
} // current != null;
|
||||||
|
|||||||
Reference in New Issue
Block a user