Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save prasoonsharma/982555 to your computer and use it in GitHub Desktop.
Save prasoonsharma/982555 to your computer and use it in GitHub Desktop.
Solve a hard Sudoku problem using R
# -----------------------------
# 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