Last chance! 50% off unlimited learning
Sale ends in
Solve a Sudoku Game
solveGame(game)
The game to be solved
A solved sudoku game object if one found, or NULL if no solution exists. The original game is attached as an attribute if the game is solved.
Given a sudoku game to be solved, find the solution. IMPORTANT: games are represented as n^2 x n^2 character matrices, using 1-9 for n=2 or 3, and LETTERS[1:(n^2)] for n = 4 or 5.
# NOT RUN {
set.seed(1234)
makeGame(3, gaps = 60) %>% solve %>% plot -> sg
(g <- originalGame(sg))
g <- emptyGame(4) # construct a patterned game
diag(g) <- LETTERS[1:16]
sg <- solve(g)
plot(sg)
# }
Run the code above in your browser using DataLab