This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Dict | |
indexed: [a] -> Dict.Dict Int a | |
indexed list = Dict.fromList (zip [0..(length list)] list) | |
type Palette = Dict.Dict Int Color | |
makePalette: [Color] -> Palette | |
makePalette colors = indexed colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Solve Every Sudoku Puzzle in Dart, optimized version | |
// A translation of: http://norvig.com/sudopy.shtml | |
// Translated and optimized by Brian Slesinsky | |
// See http://norvig.com/sudoku.html | |
// Throughout this program we have: | |
// r is a row, e.g. 'A' | |
// c is a column, e.g. '3' | |
// s is a Square, e.g. 'A3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python | |
------ | |
$ python sudoku.py | |
All tests pass. | |
Solved 95 of 95 hard puzzles (avg 0.02 secs (47 Hz), max 0.10 secs). | |
Solved 11 of 11 hardest puzzles (avg 0.01 secs (130 Hz), max 0.01 secs). | |
Solved 99 of 99 random puzzles (avg 0.01 secs (155 Hz), max 0.02 secs). | |
Macintosh:~/dart/sudoku/bin skybrian | |
$ python sudoku.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Solve Every Sudoku Puzzle in Dart | |
// A translation of: http://norvig.com/sudopy.shtml | |
// Translated by Brian Slesinsky | |
// See http://norvig.com/sudoku.html | |
// Throughout this program we have: | |
// r is a row, e.g. 'A' | |
// c is a column, e.g. '3' | |
// s is a square, e.g. 'A3' |
NewerOlder