solveGame {sudokuAlt}R Documentation

Solve a Sudoku Game

Description

Solve a Sudoku Game

Usage

solveGame(game)

Arguments

game

The game to be solved

Details

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.

Value

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.

Author(s)

Bill Venables

Examples

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)

[Package sudokuAlt version 0.2-1 Index]