purpose
I am creating a program that generates a 3D maze, and I am having problems with the creation algorithm. For ease of interaction, it will be a rectangular prism with one input and one output.
Algorithm
The problem is the actual coding of the algorithm: I decided that the best way to go with this is to create a class called MazeBlockthat has six Boolean states (up, down, left, right, in, out) that mean in which direction the maze can go farther. using the three-dimensional array MazeBlocks, I want to fill the maze, each iteration of filling checks the blocks on the left, right, top, bottom, and behind it to see if there is any opening for this side to which you need to attach.
I already have one that will make ribs by placing random open slots towards the maze. All I came across is a real interior, ensuring that the labyrinth has one entrance, one exit and one solution to go through it (I once decided a โdifficultโ 3D maze in a pop-up book, having only a few steps opposite the direction.
Question
Like me, I think I have a basic idea for the algorithm, but I donโt know how to encode it. Can anyone come up with a Java algorithm for this that quickly performs a task?
The solution should not use external libraries.
source
share