Created
May 20, 2011 08:29
-
-
Save prasoonsharma/982555 to your computer and use it in GitHub Desktop.
Solve a hard Sudoku problem using R
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
# ----------------------------- | |
# SUDOKU | |
# ----------------------------- | |
# Solve a Sudoku problem in seconds | |
# create a text file under c:\ drive called "hard sudoku problem.txt" with following text (without # symbol) and then run the code below | |
#85---24-- | |
#72------9 | |
#--4------ | |
#---1-7--2 | |
#3-5---9-- | |
#-4------- | |
#----8--7- | |
#-17------ | |
#----36-4- | |
install.packaged("sudoku") | |
library(sudoku) | |
s <- readSudoku("c:/hard sudoku problem.txt") | |
s | |
solveSudoku(s) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment