{"id":19311800,"url":"https://github.com/ifimust/room_generator","last_synced_at":"2026-05-07T10:34:31.737Z","repository":{"id":252984060,"uuid":"825994713","full_name":"ifIMust/room_generator","owner":"ifIMust","description":"Room generator service for 2D game levels","archived":false,"fork":false,"pushed_at":"2025-09-21T17:35:13.000Z","size":23287,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T17:42:54.067Z","etag":null,"topics":["flask","google-app-engine","microservice","numpy","procedural-generation","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/ifIMust.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,"zenodo":null}},"created_at":"2024-07-08T22:56:23.000Z","updated_at":"2025-09-21T17:35:16.000Z","dependencies_parsed_at":"2024-11-10T00:30:58.783Z","dependency_job_id":"7cb3887e-8670-4b11-b648-70f353a275b8","html_url":"https://github.com/ifIMust/room_generator","commit_stats":null,"previous_names":["ifimust/room_generator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ifIMust/room_generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifIMust%2Froom_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifIMust%2Froom_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifIMust%2Froom_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifIMust%2Froom_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ifIMust","download_url":"https://codeload.github.com/ifIMust/room_generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifIMust%2Froom_generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32733680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["flask","google-app-engine","microservice","numpy","procedural-generation","python"],"created_at":"2024-11-10T00:30:17.982Z","updated_at":"2026-05-07T10:34:31.732Z","avatar_url":"https://github.com/ifIMust.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# room_generator\n## Description\nroom_generator is a service that generates 2D \"rooms\" in JSON format.\nThis is useful for e.g. procedural roguelike/dungeon games if the rooms are aggregated into a larger level.\nIt is intended for use with [level_generator](https://github.com/ifIMust/level_generator) (not yet released).\n\nDepending on request criteria, it may create a rectangle, circle, or ellipse shape.\nWalls have closed diagonals.\n\nroom_generator can be deployed to Google App Engine or run locally.\n\n## Usage\nTo generate a room with height 11 and width 7, GET `/?h=11\u0026w=7`.\n\n### Parameters\n- `h` and `w` have a minimum size of 3 and default of 3.\n- `v` enables void tiles for circles and ellipses (default false). Use `?v=true` or `?v=1`.\n- `type` explicitly requests a room shape: `rectangle`, `circle`, or `ellipse` (case insensitive). If not provided, the shape is automatically selected based on dimensions.\n\n### Shape Requirements\nWhen using explicit `type` requests, dimensions must meet specific requirements:\n\n- **Rectangle**: Any `h \u003e= 3` and `w \u003e= 3`\n- **Circle**: Must have `h == w`, both odd numbers, and `\u003e= 5` (minimum 5x5)\n- **Ellipse**: Both `h` and `w` must be odd numbers and `\u003e= 5`\n\nInvalid dimension combinations return HTTP 400 error.\n\nThe output format is a JSON document describing the room. Each nested list in `data` represents a row.\n0 is floor, 1 is wall, 127 is void (used for circle/ellipse backgrounds).\n\n### Examples\nIf a local server is running on port 4949:\n\n**Basic rectangle:** `http://localhost:4949/?h=3\u0026w=4` yields (when pretty-printed):\n```\n{\n  \"data\": [\n    [1, 1, 1, 1],\n    [1, 0, 0, 1],\n    [1, 1, 1, 1]\n  ],\n  \"shape\": [3, 4],\n  \"style\": \"rectangle\"\n}\n```\n\n**Explicit circle:** `http://localhost:4949/?h=7\u0026w=7\u0026type=circle` creates a 7x7 circle.\n\n**Explicit ellipse with void tiles:** `http://localhost:4949/?h=7\u0026w=9\u0026type=ellipse\u0026v=true` creates a 7x9 ellipse with void tiles in corners.\n\n## Running a local instance\n\n### System Dependencies\nFirst install the required system packages:\n\n**Fedora/RHEL/CentOS:**\n```\nsudo dnf install python3-devel\n```\n\n**Ubuntu/Debian:**\n```\nsudo apt-get install python3-dev\n```\n\n### Setup\nIn the room_generator project directory, create and set up the venv environment:\n```\npython3 -m venv .venv\n. .venv/bin/activate\npip install -r requirements.txt\n```\n\nUsing gunicorn:\n```\ngunicorn -b :8000 'room_generator:create_app()'\n```\n\nUsing the debug server:\n```\nflask --app room_generator run --port 4949\n```\n\nUsing waitress:\n```\nwaitress-serve --host 127.0.0.1 --port 4949 --call room_generator:create_app\n```\n\n## Testing\n\n### Running Tests\nTo run all tests:\n```\npytest\n```\n\nTo run specific test files:\n```\npytest tests/test_api.py\npytest tests/test_rectangle.py\n```\n\n### Test Coverage\nRun tests with coverage analysis:\n```\npytest --cov=room_generator --cov-report=term-missing\n```\n\nGenerate an HTML coverage report:\n```\npytest --cov=room_generator --cov-report=html\n```\n\nThe HTML report will be generated in the `htmlcov/` directory. Open `htmlcov/index.html` in a web browser to view detailed coverage information.\n\n### Code Quality\nRun the linter to check code style:\n```\nflake8 room_generator tests\n```\n\n## Architecture Notes\n\n### Code Organization\n- **Unified Interface**: All generators use `generate_X(height, width, void=False)` signature\n- **Internal Validation**: Each shape module validates its own requirements and raises ValueError for invalid inputs\n- **Dispatch Pattern**: API uses single entry point with try/catch error handling\n- **Auto-selection**: Automatic shape choice based on dimensions when no explicit type given\n\n### Adding New Room Types\n1. Create new module with `generate_X(height, width, void=False)` function that validates internally\n2. Add to dispatch table in `room_generator/__init__.py`\n3. Add comprehensive tests covering valid/invalid cases\n4. Update documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifimust%2Froom_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fifimust%2Froom_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifimust%2Froom_generator/lists"}