Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rm-hull/sudoku
A Scala / Play! 2.x sudoku solver for deployment on Heroku
https://github.com/rm-hull/sudoku
Last synced: about 1 month ago
JSON representation
A Scala / Play! 2.x sudoku solver for deployment on Heroku
- Host: GitHub
- URL: https://github.com/rm-hull/sudoku
- Owner: rm-hull
- Created: 2012-11-25T00:55:42.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-01T14:57:50.000Z (almost 11 years ago)
- Last Synced: 2024-10-03T12:17:40.008Z (about 2 months ago)
- Language: CSS
- Homepage: sudoku.destructuring-bind.org
- Size: 526 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Sudoku
======A Scala / Play! 2.x sudoku solver for deployment on Heroku at http://sudoku.destructuring-bind.org.
Initially written to compare and contrast an identically implemented Clojure
solver, whose source can be found here:
https://github.com/rm-hull/project-euler/blob/master/src/euler096.clj,
but mainly to play with Play!.>"HOW TO PLAY: Fill in the grid so that every row, every column and every 3 × 3
box contains the digits 1–9. There’s no maths involved. You solve the puzzle with
reasoning and logic."_Advice on how to play Sudoku, The Independent Newspaper_
How to build & deploy
---------------------
* install sbt 0.12.1 if you do not have it already. You can get it from
here: http://www.scala-sbt.org/
* execute `sbt` and then `help play` for play specific commands* execute `sbt` and then `compile` to build the project
* execute `sbt` and then `run` to run the built-in development server
* to run directly from the shell, execute `sbt` and then `stage`; this will
create a `target/start` script which allows the application to run stand-aloneTrivia
------
There are 6,670,903,752,021,072,936,960 ways of filling in a blank Sudoku
grid, according to http://www.afjarvis.staff.shef.ac.uk/sudoku/sudoku.pdf49151 grids dynamically sourced from http://school.maths.uwa.edu.au/~gordon/sudokumin.php,
randomly displayed whenever the page is reloaded, alternatively, go to
http://sudoku.destructuring-bind.org/grid/XXXX to load a specific grid.http://sudoku.destructuring-bind.org/grid/52 is reputed to be the hardest
Sudoku in the world [http://www.telegraph.co.uk/science/science-news/9359579/Worlds-hardest-sudoku-can-you-crack-it.html]Implementation Details
----------------------
There are initially two simple solvers employed iteratively in composition
with each other until the grid is solved or there is no further reduction
available:* _Single cell reduction_, where cells are progressively reduced down to be
the only candidate in a cell.* _Hidden single reduction_, where a candidate that appears with others in a
cell, but only once in a given row, column or box.It turns out that these simple techniques will _generally_ reduce down the
search space considerably, and in a good proportion of grids, solves the
grid entirely.If however this repeated simple reduction still leaves cells with multiple
candidates, then a lazy stream-based depth-first-search is used (again applying
the above reductions at each step), where the first grid which 'solves' is
returned.A side-effect of this interweaving of DFS and simple reduction considerably
shortens the search space, and allows completely empty grids to be solved.License
-------
Copyright (c) Richard Hull 2012Same as the eclipse public license - v 1.0: https://www.eclipse.org/legal/epl-v10.html
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rm-hull/sudoku/trend.png)](https://bitdeli.com/free "Bitdeli Badge")