{"id":22542543,"url":"https://github.com/maumagnaguagno/map_generator","last_synced_at":"2025-04-09T22:51:41.605Z","repository":{"id":27814691,"uuid":"31304208","full_name":"Maumagnaguagno/Map_generator","owner":"Maumagnaguagno","description":":globe_with_meridians: Map generator for the lazy game designer","archived":false,"fork":false,"pushed_at":"2024-12-26T00:44:02.000Z","size":51,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T22:51:40.259Z","etag":null,"topics":["labyrinth","map","maze","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Maumagnaguagno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-25T08:33:25.000Z","updated_at":"2024-12-26T00:44:06.000Z","dependencies_parsed_at":"2023-02-19T03:35:28.180Z","dependency_job_id":"40204276-6338-4685-937b-842000f316be","html_url":"https://github.com/Maumagnaguagno/Map_generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maumagnaguagno%2FMap_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maumagnaguagno%2FMap_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maumagnaguagno%2FMap_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maumagnaguagno%2FMap_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maumagnaguagno","download_url":"https://codeload.github.com/Maumagnaguagno/Map_generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125643,"owners_count":21051766,"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","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":["labyrinth","map","maze","ruby"],"created_at":"2024-12-07T13:10:55.947Z","updated_at":"2025-04-09T22:51:41.580Z","avatar_url":"https://github.com/Maumagnaguagno.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Map generator [![Actions Status](https://github.com/Maumagnaguagno/Map_generator/workflows/build/badge.svg)](https://github.com/Maumagnaguagno/Map_generator/actions)\n**Map generator for the lazy game designer**\n\nAn implementation of the **Recursive Division** algorithm for maze generation, using an iterative approach instead.\nAdded wall to tile conversion method to use with tile based engines.\nThe code was adapted from [The Buckblog](http://weblog.jamisbuck.org/2011/1/12/maze-generation-recursive-division-algorithm), the original code is in this [gist](https://gist.github.com/jamis/761525).\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/11094484/14408449/e29d9948-fecb-11e5-823a-0573234b549e.gif\" alt=\"Animation with execution commands\"/\u003e\n\u003c/p\u003e\n\n## Execution\n- Execute terminal (ANSI support) with default configurations or user provided values\n```Shell\nruby Mapgen.rb [width=10] [height=width] [room_size=1] [seed=4] [sleep=0.02]\n```\n\n- Execute tests\n```Shell\nruby test_mapgen.rb\n```\n\n## Map representation\nAlthough maps of MxN cells are internally represented by a MxN structure, they can be displayed in different ways.\nEach cell may contain walls to their bottom and right sides, yielding 4 cases:\n- 0: No walls\n- 1: Bottom\n- 2: Right\n- 3: Bottom and right\n\nUsing ``Mapgen 4 4 1 4 0.02`` one will obtain the following map with all 4 cases:\n\n```\n1210\n0101\n1310\n0000\n```\n\n``display_maze`` uses spaces, pipes and underscores to represent clear or walled cells.\nAs some cells can have both bottom and right walls, ``_|``, they require twice the amount of characters to be represented.\nThe outer walls add one extra top row and left collumn, rendering (2M+1)x(N+1) maps.\n\n```\n_________\n|_  |_  |\n|  _   _|\n|___|_  |\n|_______|\n```\n\n``wall_to_tile`` converts both cells and walls to different tiles, creating 4 tiles for each cell and an extra row and collumn of cells.\nThis happens due to the walls between each N cells also becoming tiles (N-1 walls) plus outer border walls (2), rendering: (2M+1)x(2N+1) tile maps.\n\n```\n(N cells) + (N-1 walls) + (2 walls) = 2N + 1 tiles\n```\n\n```\n#########\n#   #   #\n### ### #\n#       #\n#  ##  ##\n#   #   #\n####### #\n#       #\n#########\n```\n\nThis also means these two display formats will have odd dimensions and borders around the entire map.\nThis may be good (no limit checking) or bad (ugly dimensions, no toroidal map support).\n\n## Projects using Map generator\n- [x3030](https://github.com/pravj/x3030): Maze game for Google Chrome based on [that bug](https://code.google.com/p/chromium/issues/detail?id=533361).\n\nFeel free to use Map generator in your projects and send me a link to add here.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaumagnaguagno%2Fmap_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaumagnaguagno%2Fmap_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaumagnaguagno%2Fmap_generator/lists"}