Question: Write a program in Java that generates mazes of arbitrary size using the union-find algorithm. A simple algorithm to generate the maze is to start
Write a program in Java that generates mazes of arbitrary size using the union-find algorithm. A simple algorithm to generate the maze is to start by creating an N x M grid of cells separated by walls on all sides, except for entrance and exit. Then continually choose a wall randomly, and knock it down if the cells are not already connected to each other. If we repeat the process until the starting and ending cells are connected, we have a maze. It is better to continue knocking down the walls until every cell is reachable from every cell as this would generate more false leads in the maze. \
Test you algorithm by creating a 10 x 10 grid, and print all the walls that have been knocked down. Draw the resulting maze (hand-drawing is acceptable).
Step by Step Solution
There are 3 Steps involved in it
Java Program Maze Generator Using UnionFind Algorithm Question ID 10529731 1 Algorithm Overview Grid Setup Each cell starts with 4 walls UnionFind Use ... View full answer
Get step-by-step solutions from verified subject matter experts
