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' |
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, 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
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
import Dict | |
type Painting = {palette: [Color], grid: [[Int]]} | |
model: Painting | |
model = { | |
palette = [red, orange, yellow, green, blue, purple], | |
grid = [[0,1,2,3,4,5], [1,2,3,4,5,0], [2,3,4,5,0,1]] } | |
indexed: [a] -> Dict.Dict Int a |
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 | |
import Graphics.Input (Input, input, clickable) | |
type Pixel = (Int) | |
type Palette = {length: Int, colors: Dict.Dict Pixel Color} | |
makePalette: [Color] -> Palette | |
makePalette list = | |
let indexed = zip [0..(length list) - 1] list |
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 | |
import Graphics.Input (Input, input, hoverable) | |
import Mouse | |
import Window | |
type Pixel = (Int) | |
type Palette = {length: Int, colors: Dict.Dict Pixel Color} | |
makePalette: [Color] -> Palette |
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 'dart:html'; | |
import 'package:angular2/angular2.dart'; | |
import 'package:angular2/src/reflection/reflection.dart' show reflector; | |
import 'package:angular2/src/reflection/reflection_capabilities.dart' | |
show ReflectionCapabilities; | |
void main() { | |
reflector.reflectionCapabilities = new ReflectionCapabilities(); | |
bootstrap(Grid); |
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
{ | |
"[plaintext]": { | |
"editor.quickSuggestions": false, | |
"editor.wordWrap": "bounded" | |
}, | |
// See: https://github.com/Microsoft/vscode/issues/34606 | |
"editor.autoClosingBrackets": false, | |
"editor.stablePeek": true, | |
"files.autoSave": "onFocusChange", |
OlderNewer