{"_id":"@alekstar79/maze-generator","_rev":"2-ab1b082f99fe72cb01f65ad12fcc4b61","name":"@alekstar79/maze-generator","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@alekstar79/maze-generator","version":"1.0.0","keywords":["maze","maze-generator","eller-algorithm","procedural-generation","typescript","cave-generator","cellular-automaton","pathfinding"],"author":{"name":"Aleksey Tarasenko","email":"alekstar79@yandex.ru"},"license":"MIT","_id":"@alekstar79/maze-generator@1.0.0","maintainers":[{"name":"alekstar79","email":"alekstar79@yandex.ru"}],"homepage":"https://alekstar79.github.io/maze-ts","bugs":{"url":"https://github.com/alekstar79/maze-ts/issues"},"dist":{"shasum":"ea3b33c784729c16d3984ea5bd9c9de5f8b990c0","tarball":"https://registry.npmjs.org/@alekstar79/maze-generator/-/maze-generator-1.0.0.tgz","fileCount":18,"integrity":"sha512-NlTZe4S1+G7wIvaNEyvbcLgteETJ8V51OTG2o4r877nrPBJzqj3V9Qn4Gbum49T01orcEuKjRML5dIBjapYNwA==","signatures":[{"sig":"MEUCIQDTVnKvOt4mb806Lj/fTHBFRBGFhXuNr/5H0mi/aUGqHAIgYMAcyGfSI19qod17a0N8kyY02nY8Kl9DJ+aK2Vw8D5E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53219},"main":"dist/maze-generator.umd.js","type":"module","types":"dist/index.d.ts","module":"dist/maze-generator.es.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/maze-generator.es.js","require":"./dist/maze-generator.umd.js"}},"gitHead":"ad4b5f4c408355176563474a1aaea3e0d81a8ced","private":false,"scripts":{"dev":"vite","test":"vitest run --config vitest.config.ts","preview":"vite preview --mode demo","build:lib":"vite build --config vite.lib.config.ts","build:demo":"vite build --mode demo","test:coverage":"vitest run --coverage","prepublishOnly":"npm run build:lib"},"_npmUser":{"name":"alekstar79","email":"alekstar79@yandex.ru"},"repository":{"url":"git+https://github.com/alekstar79/maze-ts.git","type":"git"},"_npmVersion":"10.9.9","description":"High-performance TypeScript library for generating perfect mazes using Eller's algorithm and organic caves using cellular automata.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"vue":"^3.4.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"sass":"^1.80.0","vite":"^5.0.0","vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","vite-plugin-dts":"^3.9.0","@vitejs/plugin-vue":"^5.0.0","@vitest/coverage-v8":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/maze-generator_1.0.0_1787303128694_0.8415537783868028","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alekstar79/maze-generator","version":"1.0.1","description":"High-performance TypeScript library for generating perfect mazes using Eller's algorithm and organic caves using cellular automata.","author":{"name":"Aleksey Tarasenko","email":"alekstar79@yandex.ru"},"type":"module","license":"MIT","private":false,"main":"dist/maze-generator.umd.js","module":"dist/maze-generator.es.js","types":"dist/types/index.d.ts","exports":{".":{"import":"./dist/maze-generator.es.js","require":"./dist/maze-generator.umd.js","types":"./dist/index.d.ts"}},"keywords":["maze","maze-generator","eller-algorithm","procedural-generation","typescript","cave-generator","cellular-automaton","pathfinding"],"homepage":"https://alekstar79.github.io/maze-ts","repository":{"type":"git","url":"git+https://github.com/alekstar79/maze-ts.git"},"bugs":{"url":"https://github.com/alekstar79/maze-ts/issues"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"dev":"vite","build:lib":"vite build --config vite.lib.config.ts","build:demo":"vite build --mode demo","preview":"vite preview --mode demo","test":"vitest run --config vitest.config.ts","test:coverage":"vitest run --coverage","prepublishOnly":"npm run build:lib"},"dependencies":{"vue":"^3.4.0"},"devDependencies":{"@types/node":"^20.0.0","@vitest/coverage-v8":"^1.0.0","@vitejs/plugin-vue":"^5.0.0","sass":"^1.80.0","typescript":"^5.0.0","vite":"^5.0.0","vite-plugin-dts":"^3.9.0","vitest":"^1.0.0"},"_id":"@alekstar79/maze-generator@1.0.1","gitHead":"a8593d5fa64534298b1e6688441c827e29e9d2e3","_nodeVersion":"22.21.1","_npmVersion":"10.9.9","dist":{"integrity":"sha512-VFItooVOrTNt4yaBhpV9ttctf/dUOl1qvDkC4IM0kz4d3d85sla/Vss4ShC5KUIKC6riihiryOr+2N3mTr16/w==","shasum":"ed521adf770ee5de40b36e61bfa48e18b7c134aa","tarball":"https://registry.npmjs.org/@alekstar79/maze-generator/-/maze-generator-1.0.1.tgz","fileCount":18,"unpackedSize":53225,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFpQtxcWE0NaldGW0SPlcibGJwTCjtqOh6/lyzyobBMWAiEA+1SmORv8rWSsGM+79pGmiWkTjV0GaTWuEDtf3n+q+zc="}]},"_npmUser":{"name":"alekstar79","email":"alekstar79@yandex.ru"},"directories":{},"maintainers":[{"name":"alekstar79","email":"alekstar79@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/maze-generator_1.0.1_1787304025561_0.015472120721747196"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-21T09:05:28.472Z","modified":"2026-08-21T09:20:25.873Z","1.0.0":"2026-08-21T09:05:28.852Z","1.0.1":"2026-08-21T09:20:25.716Z"},"bugs":{"url":"https://github.com/alekstar79/maze-ts/issues"},"author":{"name":"Aleksey Tarasenko","email":"alekstar79@yandex.ru"},"license":"MIT","homepage":"https://alekstar79.github.io/maze-ts","keywords":["maze","maze-generator","eller-algorithm","procedural-generation","typescript","cave-generator","cellular-automaton","pathfinding"],"repository":{"type":"git","url":"git+https://github.com/alekstar79/maze-ts.git"},"description":"High-performance TypeScript library for generating perfect mazes using Eller's algorithm and organic caves using cellular automata.","maintainers":[{"name":"alekstar79","email":"alekstar79@yandex.ru"}],"readme":"# Maze Generator\n\n[![npm version](https://img.shields.io/npm/v/@alekstar79/maze-generator.svg?style=flat-square)](https://www.npmjs.com/package/@alekstar79/maze-generator)\n[![npm bundle size](https://packagephobia.com/badge?p=@alekstar79/maze-generator)](https://packagephobia.com/result?p=@alekstar79/maze-generator)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)\n[![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square)](https://github.com/alekstar79/maze-ts)\n\nA modern, zero-dependency TypeScript library for generating **perfect mazes** using **Eller's Algorithm** and organic caves using **Cellular Automata**. Designed for seamless integration with Canvas, Vue, React, or any other UI framework.\n\n![maze](maze.jpg)\n\n<!-- TOC -->\n* [Maze Generator](#maze-generator)\n  * [🚀 Key Features](#-key-features)\n  * [📦 Installation](#-installation)\n  * [🧩 Basic Usage (Instant Generation)](#-basic-usage-instant-generation)\n  * [🎥 Animated Generation (Step-by-Step)](#-animated-generation-step-by-step)\n  * [🌍 Cave Generation (Cellular Automaton)](#-cave-generation-cellular-automaton)\n  * [🧠 Pathfinding (Wave Algorithm)](#-pathfinding-wave-algorithm)\n  * [📚 API Reference](#-api-reference)\n  * [🛠️ Development & Demo](#-development--demo)\n  * [📝 License](#-license)\n  * [🤝 Contributing](#-contributing)\n<!-- TOC -->\n\n## 🚀 Key Features\n\n- **Eller's Algorithm** – Guarantees the generation of perfect mazes (no loops, no isolated regions) with a time complexity of `O(N)`.\n- **Animated Generation Support** – Built-in generator (`yield`) that yields control after processing each row, enabling smooth step-by-step rendering.\n- **Cellular Automaton Cave Generation** – Simulates organic cave structures using configurable `birthLimit` and `deathLimit` rules.\n- **Pathfinding** – Integrated Wave Algorithm (BFS) to find the shortest path between any two points.\n- **Serialization** – Full support for saving and loading mazes/caves in both human-readable `.txt` and `.json` formats.\n- **Strict TypeScript** – Fully typed, offering excellent IDE autocompletion and type safety.\n- **100% Test Coverage** – Comprehensive unit tests covering all core functionality (lines, functions, and branches).\n\n## 📦 Installation\n\n```bash\nnpm install @alekstar79/maze-generator\n```\n\n## 🧩 Basic Usage (Instant Generation)\n\n```typescript\nimport { MazeFacade } from '@alekstar79/maze-generator';\n\n// Create the facade instance\nconst facade = new MazeFacade();\n\n// Generate a 10x10 maze instantly\nfacade.generateMaze(10, 10);\n\n// Export the maze in plain text (compatible with original C++ format)\nconst text = facade.maze.toTXT();\nconsole.log(text);\n\n// Export the maze as JSON\nconst json = facade.maze.toJSON();\nconsole.log(json);\n```\n\n## 🎥 Animated Generation (Step-by-Step)\n\nThe library provides a built-in generator that yields after each row is processed, making it perfect for live animation (Canvas, HTML, Vue, etc.):\n\n```typescript\nimport { MazeFacade } from '@alekstar79/maze-generator';\n\nconst facade = new MazeFacade();\n\n// Get the generator\nconst generator = facade.generateMazeStepByStep(10, 10);\n\n// Iterate with a delay (e.g., 100ms per step)\nfor await (const processedRow of generator) {\n  // processRow is the index of the row just completed.\n  // Here you would call your draw/update method.\n  await new Promise(resolve => setTimeout(resolve, 100));\n  // canvas.drawMaze();\n}\n```\n\n## 🌍 Cave Generation (Cellular Automaton)\n\n```typescript\nfacade.generateCave({\n  rows: 10,\n  cols: 10,\n  birthLimit: 4,\n  deathLimit: 3,\n  chance: 50 // initial alive probability (%)\n});\n\n// Step the simulation manually\nfacade.stepCave();\n\n// Export the cave\nconsole.log(facade.cave.toTXT());\n```\n\n## 🧠 Pathfinding (Wave Algorithm)\n\nOnce a maze is generated, find the shortest path between two points:\n\n```typescript\nconst start = { x: 0, y: 0 };\nconst end = { x: 5, y: 5 };\n\nconst path = facade.findPath(start, end);\n// path returns an array of { x, y } coordinates\n```\n\n## 📚 API Reference\n\n- `MazeFacade` – Main entry point.\n- `Maze` – Core maze model with `generateMaze`, `toTXT`, `toJSON`.\n- `Cave` – Core cave model with `generateMap`, `updateMap`, `toTXT`.\n- `Pacman` – Pathfinding logic.\n- `Matrix` – Lightweight 2D boolean matrix for wall representation.\n\n## 🛠️ Development & Demo\n\nThis repository includes a `demo/` folder with a complete Vue 3 + Vite application showcasing the library.\nTo run the demo locally:\n\n```bash\ncd demo\nnpm install\nnpm run dev\n```\n\n## 📝 License\n\nMIT License. See [LICENSE](LICENSE) for more information.\n\n\n## 🤝 Contributing\n\nIssues and pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.\n","readmeFilename":"README.md"}