solveGame {sudokuAlt} | R Documentation |
Solve a Sudoku Game
solveGame(game)
game |
The game to be 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.
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.
Bill Venables
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)