Freitag Software
The Joy of Writing Software has moved to software.dafreitag.com !
  • Home

Mazes for Programmers

I enjoyed Jamis Buck's book, Mazes for Programmers, but the code examples were in Ruby. So, to help Java programmers who want to use maze creating algorithms, I wrote similar maze generation code in Java for a few of the maze types. 

For more maze generation algorithms and a lot more interesting maze-related projects, go buy the book! 

MazeDemoProgram

To demonstrate the  mazes, I created a demo program that enables you to create a variety of mazes (to the Java console), and to compare the number of dead ends in each type of maze. 

​
Download the below file and use your favorite IDE to compile and run the MazeDemoProgram.java file.  Enjoy! 

​

javamazes.zip
File Size: 17 kb
File Type: zip
Download File

Picture
Below is the main menu from the above program. You can create different types of mazes or change some of the parameters before creating a maze. 
***********************************
    Maze Creation Demo Program              *
***********************************
* Create a Maze:                                          
*      1. Binary Tree                                       
*      2. Sidewinder                                       
*      3. Aldous-Broder                                 
*      4. Wilson                                               
*      5. Hunt and Kill                                    
*      6. Recursive Backtracker                   
*      7. Recursive Division                         
*                                                                    
* Change Defaults:                
*     10. Array Size: 10 X 15    
*     11. Braiding:   0%          
*     12. ShowLongestPath:  true  
*     13. ShowDistances:  true    
*                                 
* Run Deadend Counts Comparison   
*     14. Run Comparison          
*                                 
*     99. Exit      
             
***********************************
Please choose an option.

This website documents my continuing education in software development.
I hope it is useful and entertaining for you to read. 
An old programmer learning new tricks... 
(c) 2017 David A. Freitag, all rights reserved.