This program generates a random maze of a given length and width using Kruskal’s and the union-find algorithm. Utilizing the javalib Image Library, it displays this maze when the program is run. The user can then tap either the ‘d’ or ‘b’ keys on their keyboard to start a depth-first or breadth-first search, respecfully. When the path is found from the start point (the green square at the top left) to the end square (red square at the bottom right), the path is then traced backwards in a dark blue color.
To view this code, please visit my GitHub.