{"id":22104574,"url":"https://github.com/martinpeck/mazes-ruby","last_synced_at":"2025-08-14T00:15:31.700Z","repository":{"id":45450941,"uuid":"270364499","full_name":"martinpeck/mazes-ruby","owner":"martinpeck","description":"Maze algorithms, written in Ruby. Just a bit of fun, and based upon the awesome book \"Mazes for Programmers\"","archived":false,"fork":false,"pushed_at":"2024-10-28T18:36:36.000Z","size":425,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-13T19:46:53.639Z","etag":null,"topics":["fun","mazes","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinpeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-07T16:26:41.000Z","updated_at":"2024-08-02T09:41:46.000Z","dependencies_parsed_at":"2022-08-04T15:15:50.560Z","dependency_job_id":null,"html_url":"https://github.com/martinpeck/mazes-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/martinpeck/mazes-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinpeck%2Fmazes-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinpeck%2Fmazes-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinpeck%2Fmazes-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinpeck%2Fmazes-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinpeck","download_url":"https://codeload.github.com/martinpeck/mazes-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinpeck%2Fmazes-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266456245,"owners_count":23931383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fun","mazes","ruby"],"created_at":"2024-12-01T06:33:09.403Z","updated_at":"2025-07-22T08:31:47.146Z","avatar_url":"https://github.com/martinpeck.png","language":"Ruby","readme":"# Mazes for Programmers - Ruby Implementations\n\nThis repository contains Ruby implementations of maze algorithms, copied or based upon those in the EXCELLENT book \"Mazes for Programmers\"\n\n\u003chttps://pragprog.com/book/jbmaze/mazes-for-programmers\u003e \n\n## Installing and Running Stuff\n\nThis is a personal project so work it out yourself! \n\nMy top tip...\n\n**Use VS Code, and use the Dev Container that is defined in this repository**. If you do that you'll be set up with a fully functioning Ruby development environment without having to set it up manually! Want to know more...?\n\n\u003chttps://code.visualstudio.com/docs/remote/containers\u003e\n\nYou will need to run `bundle install` the first time you open the project to install the gemfiles that are requried.\n\nI've created a number of Rake tasks to make it easy for me to run the demos. At the time of writing, these are the defined rake tasks...\n\n``` bash\nrake algorithms:aldous_broder           # Algorithm demo: Aldous Broder\nrake algorithms:aldous_broder_coloured  # Algorithm demo: Aldous Broder, with colour\nrake algorithms:binary_tree             # Algorithm demo: Binary Tree\nrake algorithms:binary_tree_colour      # Algorithm demo: Binary Tree, with colour\nrake algorithms:hunt_and_kill           # Algorithm demo: Hunt and Kill\nrake algorithms:kruskal                 # Algorithm demo: Kruskal\nrake algorithms:recursive_backtracker   # Algorithm demo: Recursize Backtracker\nrake algorithms:sidewinder              # Algorithm demo: Sidewinder\nrake algorithms:sidewinder_colour       # Algorithm demo: Sidewinder, with colour\nrake algorithms:wilsons                 # Algorithm demo: Wilsons\nrake default                            # Run most of the demos\nrake distances:dead_ends                # Counts the dead ends maze generated with a selection of algoritms\nrake distances:dikstra                  # Distances: Distra's algorithm\nrake distances:longest_path             # Shows the longest path in a maze\nrake masks:ascii_mask                   # Generates a maze using an ASCII mask\nrake masks:image_mask                   # Generates a maze using an image mask\nrake masks:simple_mask                  # Demonstrates a simple ASCII mask\nrake shapes:hex                         # Hex Grid\nrake shapes:polar                       # Polar Grid\nrake shapes:triangle                    # Triangle Grid\nrake advanced:braid                     # Braided Grid\nrake advanced:weighted                  # Weighted Maze\nrake advanced:weave                     # Weave Maze\n```\n\nThe list the rake tasks run `rake -T -A` from the terminal. \n\nEach of the algorithms has a demo script. Assuming you have your Ruby environment set up you should be able to run something like...\n\n```bash\nruby demos/recursive_backtracker_demo.rb\n```\n\n... and this will either generate files in the `output` directory, or will write output directly to the terminal\n\n## Some Example Output\n\n### A Coloured Theta (Polar Grid, or Circular Maze)\nIn this example, colour is used to show the distance from the centre cell.\n\n![](examples/polar_grid.png)\n\n### A Coloured Sigma (Maze with Hexagonal Cells)\nIn this example, colour is used to show the distance from the top left hex cell.\n\n![](examples/hex.png)\n\n### A Coloured Delta (Maze with Triangular Cells)\nIn this example, colour is used to show the distance from the central cell.\n\n![](examples/delta.png)\n\n### Braided Mazes\nBraids are mazes that include loops. This particular braided maze was created using the recursize backtracker algorithm, and then 50% of the deadends were opened up to create the loops.\n\n![](examples/braided_recursive_backtracker.png)\n\n### Weave Mazes\nWeave mazes allow for passageways to cross over each other. \n\n![](examples/weave_maze.png)\n\n### A Weighted Maze\nIn this example you can see the shortest path from top right to bottom left, and then the impact of placing lava within that path. The lava cell becomes more costly (through weights) is represented by the red cell.\n\n![](examples/maze_with_lava.png)\n\n### Sidewinder Image Maze\nThis maze was generated using the sidewinder algorithm.\n\n![](examples/sidewinder.png)\n\n### Sizewinder ASCII Maze\nThis is an ASCII representation of the above maze.\n\n\n``` text\n+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n|                                                           |\n+   +---+   +---+---+   +   +---+   +   +---+---+   +---+   +\n|       |   |           |       |   |           |   |       |\n+   +   +---+   +   +---+---+   +---+---+   +   +   +   +   +\n|   |   |       |           |       |       |   |   |   |   |\n+---+---+   +---+   +---+---+---+---+---+---+---+   +---+---+\n|               |   |                                       |\n+   +   +---+   +   +---+   +   +---+   +---+---+---+   +   +\n|   |       |   |   |       |       |               |   |   |\n+   +   +---+   +   +---+---+---+---+   +   +   +---+---+   +\n|   |       |   |   |                   |   |   |           |\n+   +   +---+---+   +---+---+   +---+   +   +---+---+   +   +\n|   |           |           |       |   |   |           |   |\n+   +---+   +   +   +   +---+---+   +---+---+---+   +---+   +\n|       |   |   |   |   |                   |       |       |\n+   +   +   +   +---+---+   +---+   +---+   +---+---+   +   +\n|   |   |   |   |               |   |       |           |   |\n+   +   +   +   +---+   +---+   +   +---+   +   +   +---+   +\n|   |   |   |       |       |   |       |   |   |   |       |\n+   +   +   +---+   +---+---+   +   +---+   +   +---+---+---+\n|   |   |   |               |   |       |   |               |\n+   +   +   +   +   +---+---+---+   +---+   +---+---+---+   +\n|   |   |   |   |               |   |               |       |\n+   +   +   +---+   +---+   +---+   +   +   +   +---+---+   +\n|   |   |   |           |   |       |   |   |       |       |\n+   +---+---+---+   +   +   +   +   +---+   +   +   +   +---+\n|               |   |   |   |   |       |   |   |   |       |\n+   +   +   +---+---+---+   +---+---+---+---+   +---+---+---+\n|   |   |               |               |                   |\n+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n\n```\n### Recursive Backtracker Image Maze\nAgain, colour represents distance from the central cell.\n\n![](examples/recursive_backtracker.png)\n\n### Recursive Backtracker Maze with Image Mask\nA bitmap mask has been used to constrain this maze.\n\n![](examples/image_mask.png)\n ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinpeck%2Fmazes-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinpeck%2Fmazes-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinpeck%2Fmazes-ruby/lists"}