Added code to minimize the number of doorways that involve dropping through the floor. Added a DisjointSet class as part of the implementation. I also split the maze construction process into two classes (MazeDesigner and MazeBuilder) to make it clearer.
49 lines
872 B
Java
49 lines
872 B
Java
package StevenDimDoors.experimental;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
public class MazeDesign
|
|
{
|
|
private PartitionNode root;
|
|
private DirectedGraph<PartitionNode, DoorwayData> rooms;
|
|
private ArrayList<IGraphNode<PartitionNode, DoorwayData>> cores;
|
|
|
|
public MazeDesign(PartitionNode root, DirectedGraph<PartitionNode, DoorwayData> rooms,
|
|
ArrayList<IGraphNode<PartitionNode, DoorwayData>> cores)
|
|
{
|
|
this.root = root;
|
|
this.rooms = rooms;
|
|
this.cores = cores;
|
|
}
|
|
|
|
public PartitionNode getRootPartition()
|
|
{
|
|
return root;
|
|
}
|
|
|
|
public DirectedGraph<PartitionNode, DoorwayData> getRoomGraph()
|
|
{
|
|
return rooms;
|
|
}
|
|
|
|
public ArrayList<IGraphNode<PartitionNode, DoorwayData>> getCoreNodes()
|
|
{
|
|
return cores;
|
|
}
|
|
|
|
public int width()
|
|
{
|
|
return root.width();
|
|
}
|
|
|
|
public int height()
|
|
{
|
|
return root.height();
|
|
}
|
|
|
|
public int length()
|
|
{
|
|
return root.length();
|
|
}
|
|
}
|