{"id":20399562,"url":"https://github.com/garfield1002/wave-function-collapse-sudoku","last_synced_at":"2025-04-12T13:22:33.663Z","repository":{"id":128815313,"uuid":"485536447","full_name":"Garfield1002/wave-function-collapse-sudoku","owner":"Garfield1002","description":"A visualization of the wave function collapse solving a sudoku problem","archived":false,"fork":false,"pushed_at":"2022-05-01T15:41:25.000Z","size":3362,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T08:07:01.276Z","etag":null,"topics":["haskell","sudoku","wave-function-collapse"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Garfield1002.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-25T21:12:11.000Z","updated_at":"2023-04-24T00:02:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"8358ca1e-2690-475f-8c7d-98cb796a26a9","html_url":"https://github.com/Garfield1002/wave-function-collapse-sudoku","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/Garfield1002%2Fwave-function-collapse-sudoku","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Garfield1002%2Fwave-function-collapse-sudoku/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Garfield1002%2Fwave-function-collapse-sudoku/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Garfield1002%2Fwave-function-collapse-sudoku/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Garfield1002","download_url":"https://codeload.github.com/Garfield1002/wave-function-collapse-sudoku/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571991,"owners_count":21126559,"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":["haskell","sudoku","wave-function-collapse"],"created_at":"2024-11-15T04:29:54.674Z","updated_at":"2025-04-12T13:22:33.658Z","avatar_url":"https://github.com/Garfield1002.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wave Function Collapse - Sudoku\n\nA visualization of the wave function collapse algorithm used here to solve a sudoku problem.\n\nhttps://user-images.githubusercontent.com/53104608/165240320-c425d37c-1d68-4cb9-b79c-e21a0462eb65.mp4\n\nIt can also be used to solve more esoteric sudoku such as the [miracle sudoku by Mitchell Lee, solved by cracking the cryptic](https://www.youtube.com/watch?v=yKf9aUIxdb4)\n\nhttps://user-images.githubusercontent.com/53104608/166153410-acbf98f9-26a8-4f38-84b1-8c75c87cc069.mp4\n\nIn this version,\n\n\u003e Normal Sudoku rules apply. Any two cells separated by a knight's move or a king's move (in chess) cannot contain the same digit. Any two orthogonally adjacent cells cannot contain consecutive digits.\n\n## 📚 Library\n\nThe animation was made using [Haskell reanimate](https://hackage.haskell.org/package/reanimate). With a lot of help from the [N-queen problem article](https://williamyaoh.com/posts/2020-05-31-reanimate-nqueens-tutorial.html).\n\n## ⚙ Usage\n\nYou can specify and modify the rules for the game by editing [Rules.hs](https://github.com/Garfield1002/wave-function-collapse-sudoku/blob/master/src/Rules.hs).\n\nThe format for the input sudoku is a txt document with `0`s for empty squares and numbers for the given cells. For example:\n\n```txt\n0 0 0 0 0 0 0 3 0\n0 9 0 6 8 0 0 0 5\n0 4 2 0 1 0 6 0 0\n0 2 0 8 0 0 0 0 0\n0 0 1 0 0 0 0 0 0\n4 0 3 0 0 0 0 0 9\n0 0 0 0 0 0 0 2 0\n6 8 0 1 0 0 4 0 0\n0 0 0 0 0 4 0 0 3\n```\n\nI have found the best results by generating an mp4:\n\n```bash\n$ stack build\n$ stack exec animate.exe -- render --format mp4 -o sudoku.mp4 -w 1280 -h 720 --fps 24\n```\n\n## 🩹 Limitations\n\nThis visualization however isn't perfect as it does not show off the stack or any backtracking.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarfield1002%2Fwave-function-collapse-sudoku","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarfield1002%2Fwave-function-collapse-sudoku","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarfield1002%2Fwave-function-collapse-sudoku/lists"}