Created
October 6, 2010 21:09
-
-
Save invisiblefunnel/614094 to your computer and use it in GitHub Desktop.
Sends an unsolved sudoku puzzle to the sudokuwiki.org solver and scrapes the answer.
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
# Assign an unsolved sudoku to the string my_puzz. Blanks must be represented by 0's. | |
my_puzz = '046000000050001000203590040000000900700000300000804710020068100500000072000902000' | |
# cURL the sudokuwiki.org solver with the given sudoku | |
system 'curl -o solved.txt --url http://www.sudokuwiki.org/S/WebSudoku.dll?solutions\&0,' + my_puzz + ' >/dev/null 2>&1' | |
# The solved puzzle is pulled from the 6th line of the returned file. | |
puts File.open("solved.txt").readlines[6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment