{"id":16918199,"url":"https://github.com/vito/sudoku.hs","last_synced_at":"2025-08-22T00:40:38.983Z","repository":{"id":469591,"uuid":"94458","full_name":"vito/sudoku.hs","owner":"vito","description":"A Sudoku puzzle solver written in Haskell.","archived":false,"fork":false,"pushed_at":"2008-12-20T23:25:35.000Z","size":888,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T22:25:42.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/vito.png","metadata":{"files":{"readme":"README","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}},"created_at":"2008-12-20T16:24:26.000Z","updated_at":"2019-08-13T13:49:10.000Z","dependencies_parsed_at":"2022-07-07T18:22:25.598Z","dependency_job_id":null,"html_url":"https://github.com/vito/sudoku.hs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vito/sudoku.hs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vito%2Fsudoku.hs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vito%2Fsudoku.hs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vito%2Fsudoku.hs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vito%2Fsudoku.hs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vito","download_url":"https://codeload.github.com/vito/sudoku.hs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vito%2Fsudoku.hs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271568451,"owners_count":24782399,"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-08-21T02:00:08.990Z","response_time":74,"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":"2024-10-13T19:39:14.746Z","updated_at":"2025-08-22T00:40:38.945Z","avatar_url":"https://github.com/vito.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"================\n  Installation\n================\n\n    ghc -c -O TestPJ.hs\n    ghc -o sudoku sudoku.hs TestPJ.o\n\n\n=========\n  Usage\n=========\n\n    ./sudoku\n\nYou will be prompted to enter a grid. Enter one row at a time, using\nnumbers 1-9 for clue tiles and anything else (e.g. \".\", \"X\", \" \") for\nempty tiles.\n\nDon't enter an empty grid. It's not as amusing as you'd think.\n\n\n===========\n  Testing\n===========\n\nI have included two forms of tests:\n\n1. Simon's Grids\n\n    ./sudoku test\n\nThis will run through all of the grids that Simon Peyton-Jones used\nfor his (non-guessing) Sudoku solver. It should be able to solve all\nof them rather quickly, even ones Simon's couldn't solve (since his\ndoesn't guess).\n\n\n2. More Than Necessary\n\n    ./sudoku test17\n\nThis will run through all 47,793 17-clue Sudoku grids in sudoku17.txt.\n\nIt's quite boring, really. It just solves all of them until you kill it.\n\nBut it proves it works!\n\n\n=====================\n  How does it work?\n=====================\n\nThis program is not written for efficiency. It is written to be clear and\nconcise. I wrote it how a human would solve the grid, not a computer.\n\nHowever, I have found it to be quite efficient.\n\n    1. A Grid is a list of rows, each 9 tiles long. The Grid is 9 rows long.\n       The tiles are all Maybe Int, with Just X representing a filled tile,\n       and Nothing representing an empty tile. Shocking, no?\n    2. The meat of the solving is done in solveLoop.\n\nsolveLoop, guess, and tryAll:\n    1. If the grid is done, it stops there.\n    2. If the grid is stuck, it starts guessing:\n       1. `guess` will return a list of Grids, with the first empty tile\n          filled with each of its possibilties (per grid).\n       2. tryAll goes through the Grids returned by `guess`, one by one,\n          without further guessing.\n          1. If a valid grid is found without guessing, we're done.\n          2. If the grid cannot be solved without guessing, it is pushed\n             into a queue for guessing later.\n          3. After all of the tiles are gone through and no non-guessed\n             solution is found, it uses `solveLoop` on each grid, one by\n             one, repeating this cycle.\n    3. Otherwise, it will `solve` as many tiles as it can on the grid,\n       calling itself until it gets stuck (2) or it's filled (1).\n\nsolve:\n    The tile is solved if one of the following holds true:\n    \n    * There is only one possibility.\n    * It holds a number unique to all other tiles in the box.\n    * It holds a number unique to all other tiles in the row.\n    * It holds a number unique to all other tiles in the column.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvito%2Fsudoku.hs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvito%2Fsudoku.hs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvito%2Fsudoku.hs/lists"}