{"id":18612599,"url":"https://github.com/hermanplay/n-puzzle-solver","last_synced_at":"2025-11-03T00:30:27.604Z","repository":{"id":214193691,"uuid":"735923831","full_name":"HermanPlay/n-puzzle-solver","owner":"HermanPlay","description":"A simple N-Puzzle solver implemented in Go","archived":false,"fork":false,"pushed_at":"2023-12-30T14:12:16.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T02:22:21.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/HermanPlay.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-26T13:23:23.000Z","updated_at":"2024-11-08T11:07:38.000Z","dependencies_parsed_at":"2023-12-30T15:25:31.627Z","dependency_job_id":"0b1264eb-a240-4547-8cb6-b7be8b68b3f3","html_url":"https://github.com/HermanPlay/n-puzzle-solver","commit_stats":null,"previous_names":["hermanplay/n-puzzle-solver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HermanPlay%2Fn-puzzle-solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HermanPlay%2Fn-puzzle-solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HermanPlay%2Fn-puzzle-solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HermanPlay%2Fn-puzzle-solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HermanPlay","download_url":"https://codeload.github.com/HermanPlay/n-puzzle-solver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239403817,"owners_count":19632649,"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":[],"created_at":"2024-11-07T03:17:57.866Z","updated_at":"2025-11-03T00:30:27.543Z","avatar_url":"https://github.com/HermanPlay.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N-Puzzle Solver in Go\n\nThis repository contains a simple N-Puzzle solver implemented in Go. The N-Puzzle problem is a classic sliding puzzle game where a board of tiles must be rearranged to reach a goal state.\n\n## Implementation details\n\nFor searching [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm) is used together with [Manhattan Distance](https://en.wikipedia.org/wiki/Taxicab_geometry) + [Linear Conflicts](https://medium.com/swlh/looking-into-k-puzzle-heuristics-6189318eaca2#:~:text=Linear%20Conflicts,reach%20their%20final%20goal%20position.) as heuristics.\n\nBoard states are stored in 1D array of ints. To store states in a min-heap states are converted to strings as such: \n```\nNode{[1, 2, 3, 4, 5, 6, 7, 8, 0]} -\u003e \"1 2 3 4 5 6 7 8 0\"\n```\n\n## Usage\n\n1. Ensure you have Go installed on your machine.\n2. Clone this repository:\n\n   ```bash\n   git clone https://github.com/HermanPlay/n-puzzle-solver.git\n   ```\n3. Navigate to project directory:\n   ```bash\n   cd n-puzzle-solver\n   ```\n4. To run predefined tests:\n   ```bash\n   go test .\\n-puzzle\n   ```\n5. To run custom board, build the solution:\n   ```bash\n   go build\n   ```\n## Flags\n```\nUsage of n-puzzle:\n  -gen\n        (OPTIONAL) generates puzzle in the given path file\n  -path string\n        (REQUIRED) path to a file to save generated puzzle, requires size\n  -size int\n        (REQUIRED) size of one of the sides of the puzzle\n  -v    (OPTIONAL) output verbose solution path\n```\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhermanplay%2Fn-puzzle-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhermanplay%2Fn-puzzle-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhermanplay%2Fn-puzzle-solver/lists"}