-
ruby: This program was written in
ruby 3.1.2p20. Your computer may already have Ruby installed. You can check by:ruby -vOtherwise, you can head over to their installation documentation over here (ruby-lang.org).
-
colorize: To display colorful text, install the
colorize (0.8.1)gem:gem install colorizeUnix systems may require
sudo. Link to repo (github.com/fazibear).
To get the game running locally on your terminal, clone the repo to your desired directory:
git clone https://github.com/SamAdrn/Maze.git
Then, enter the the Maze directory:
cd Maze
And finally, run the runner.rb file through the ruby command:
ruby runner.rb
The whole point of the game is to get from the starting point of the maze S all the way to the ending point of the maze E, and see if you can get that treasure. You can also feel extra proud if you managed to solve the maze through the shortest path possible.
But if you are having trouble, you can have the game show you da way.
At the start of the game, you will be instructed to choose an algorithm for the maze you want to create.
Each algorithm produces its own kind of maze texture:
- Randomized Depth-First Search: High River Factor. Has long corridors since it traverses as deep as it can before backtracking.
- Randomized Kruskal's Algorithm: High Branching Factor. Has a lot of dead ends since it grows minimum spanning trees from various points within the graph.
Then, you can specify the size of your mazes:
- Mazes must be at least a
2 x 2(there's no point in having smaller mazes really). - Heights are displayed larger than widths. A maze with the dimensions
(w / 2) x wwill resemble a square.
Now, the game knows exactly what you want and will create a random maze for you depending on the algorithm you chose.
- Note that these algorithms may not create a solvable maze in the first try, and it may re-run the algorithm over and over again until it creates one that is solvable. Therefore, larger mazes may take more time to complete.
From here, you are able to choose between various commands that interact with the maze.
Most of the code are documented within the source file. However, you can view all this documentation using YARD (a Ruby Documentation Tool).
To do this, make sure you have the yard gem installed:
gem install yard
Then, run this command to document all files (including private methods) into a web document:
yardoc --private maze.rb runner.rb
You can then open the web document using the following command:
open doc/top-level-namespace.html
Written [07/01/2022]





