Freitag Software
The Joy of Writing Software
  • Home
    • Links
  • My Software
    • JavaScript Programs >
      • Dots
      • The Code Cracker
      • The Deserted Ship
      • Flying Text
    • Java Programs >
      • Dot Animation
      • Operation Rescue >
        • Mazes for Programmers
      • Battleship!
      • Blackjack
      • Draw Poker
      • State Pattern Demo
      • Falling Blocks
    • Android Programs >
      • The Oracle
      • RPSLS
      • Gemini Falcon: Asteroid Miner
      • Gemini Falcon: All Boxed In >
        • Gemini Falcon >
          • Privacy Policy
          • A Game Oddity
      • Ay Caramba
      • Dots vs Dots
      • Ants vs Ants
    • Twine Stories
  • Random Thoughts
  • Book Reviews
  • Teaching
    • Real-Life Stories
    • Flying Text
  • About
    • Contact

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.

Powered by Create your own unique website with customizable templates.