{"id":30894345,"url":"https://github.com/austintgriffith/deterministic-map","last_synced_at":"2025-09-08T21:09:23.482Z","repository":{"id":303713310,"uuid":"1015665477","full_name":"austintgriffith/deterministic-map","owner":"austintgriffith","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-09T02:45:10.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-09T03:35:21.157Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/austintgriffith.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":"2025-07-07T21:17:17.000Z","updated_at":"2025-07-09T02:45:13.000Z","dependencies_parsed_at":"2025-07-09T03:35:22.868Z","dependency_job_id":"8cddd59f-1a66-43c6-90d3-562d9672f28a","html_url":"https://github.com/austintgriffith/deterministic-map","commit_stats":null,"previous_names":["austintgriffith/deterministic-map"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/austintgriffith/deterministic-map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fdeterministic-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fdeterministic-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fdeterministic-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fdeterministic-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austintgriffith","download_url":"https://codeload.github.com/austintgriffith/deterministic-map/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fdeterministic-map/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231567,"owners_count":25245625,"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-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2025-09-08T21:09:18.697Z","updated_at":"2025-09-08T21:09:23.457Z","avatar_url":"https://github.com/austintgriffith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deterministic Map Generator\n\n## [https://cryptohunter.fun](https://cryptohunter.fun/)\n\nA deterministic map generation system that creates game maps based on cryptographic hashes. This system uses a random hash to generate consistent, reproducible maps for games.\n\n## Features\n\n- **Deterministic Generation**: Same input always produces the same output\n- **Cryptographic Entropy**: Uses SHA-256 hashing for unpredictable but reproducible randomness\n- **Modular Design**: Separate classes for dice, land generation, and player positioning\n- **Extensible**: Easy to add new land types and generation rules\n\n## Project Structure\n\n```\ndeterministic-map/\n├── src/\n│   ├── index.js                    # Main exports\n│   ├── dice.js                     # DeterministicDice class\n│   ├── gameLandGenerator.js        # GameLandGenerator class\n│   └── playerPositionGenerator.js  # PlayerPositionGenerator class\n├── example/\n│   └── generateMap.js              # Example usage script\n├── random_sample.txt               # Sample random hash\n├── package.json                    # Project dependencies\n└── README.md                       # This file\n```\n\n## Classes\n\n### DeterministicDice\n\nGenerates deterministic random numbers based on a cryptographic hash.\n\n- **Constructor**: Takes a random hash as entropy source\n- **roll(count)**: Generates random numbers using hex characters\n- **rehashEntropy()**: Extends entropy by hashing when needed\n\n### GameLandGenerator\n\nGenerates game maps with different land types.\n\n- **generateLand()**: Creates a grid of land tiles\n- **placeTreasure()**: Places treasure locations (1 + map size / 12)\n- **saveMapToFile()**: Saves map data to JSON file\n- **printMapSummary()**: Displays land type statistics\n\n### PlayerPositionGenerator\n\nGenerates deterministic starting positions for players.\n\n- **generateStartingPosition()**: Creates position for single player\n- **generateAllPlayerPositions()**: Creates positions for multiple players\n\n## Usage\n\n### Basic Example\n\n```javascript\nimport { DeterministicDice, GameLandGenerator } from \"./src/index.js\";\n\n// Create dice with random hash\nconst dice = new DeterministicDice(\"0x1234567890abcdef...\");\n\n// Generate 20x20 map\nconst generator = new GameLandGenerator(dice, 20);\ngenerator.generateLand();\ngenerator.placeTreasure();\ngenerator.saveMapToFile(\"my_map.txt\");\n```\n\n### Command Line Usage\n\n```bash\n# Generate map for game ID \"sample\"\nnode example/generateMap.js sample\n\n# Or with explicit parameter\nnode example/generateMap.js --gameId=sample\n```\n\nThis requires a file named `random_sample.txt` containing the random hash.\n\n## Land Types\n\n- **Type 1**: Common land (probability: 11/16)\n- **Type 2**: Uncommon land (probability: 4/16)\n- **Type 3**: Rare land (probability: 1/16)\n- **Type X**: Treasure\n\n## Installation\n\n```bash\nnpm install\n```\n\n## Dependencies\n\n- Node.js (ES modules support)\n- Built-in `crypto` module for hashing\n- Built-in `fs` module for file operations\n\n## Testing\n\nUse the provided `random_sample.txt` file to test the system:\n\n```bash\nnode example/generateMap.js sample\n```\n\nThis will generate a `map_sample.txt` file with the deterministic map data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustintgriffith%2Fdeterministic-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustintgriffith%2Fdeterministic-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustintgriffith%2Fdeterministic-map/lists"}