Write a program in
Java that randomly generates two-dimensional mazes and prints
them to the console. For example, a possible output might look like:
XXXXXXXXXXX
X X X
XXX X X X X
X X X X
X XXX X XXX
X X X
XXXXXXXXX X
The width of this maze is 11, and its height is 7. Your program should generate and
display 20 such mazes whose widths and heights are random odd numbers between 5 and
79, inclusive.
Each maze must be 2 entrances that are reachable from each other.
The following mazes do not meet the constraint:
XXXXXXX
X
XXXXX X
X X X There is only 1 entrance.
X XXX X
X X
XXXXXXX
X XXXXX
X X
X XXX X
X X X There are 3 entrances.
X XXX X
X X
XXX XXX
XXXXX X
X X X
X XX X X
X X X No path exists between both entrances.
X XXX X
X X X
XXX XXX
Feel free to use standard APIs in your solution.
Can any one help me in getting a logic to build a single maze atleast..! Constructing such a maze is been bugging me since two days !!!
PS: Attached is the proper image. Please download it to have better view of the mazes !