way that each number appears once, and only once
in a row, column, and subgrid (ErcseyRavasz &
Toroczkai, 2012). The rule implies each square of
the puzzle is tightly associated with other squares
located on the same row, column, and subgrid.
These squares are called ‘Peers’, and their count
number is calculated as follows:
31
(1)
where refers to the peers number of any square
in the puzzle. In a 99 Sudoku puzzle (where
and equals to 3); there are 20 peers for each square
(see
Figure 3).
Figure 3: ‘Peers’ (light red) of [F,4] square (dark red).
In order to solve a Sudoku puzzle, blank squares
have to be completed with valid candidates until the
correct number is found; each square contains what
are called ‘Potential candidates’, or simply
‘Candidates’. The potential candidates are the
possible valid values of the set of integers: one to
nine, and each square has an exclusive set of
candidates while solving the puzzle. The set of valid
candidates can be described as follows (Crook,
2007; Edelkamp & Schrodl, 2012; Klingner &
Kanakia, 2013):
1,2,..,9
\
∪
∪
(2)
where denotes the valid candidates set of the
current square , and 1


. ,,
and are assigned values sets of ’s peers located
on row, column and subgrid, respectively.
As previously mentioned, Sudoku solvers are
categorized to two main types, deductive and search
algorithms. Deductive algorithms are remarkably
slower and more difficult to develop because
immense coding effort is required (Norvig, 2010).
Each pattern requires a strategy to be recognized by
these algorithms, for instance, the ‘forbidden
rectangle’. A forbidden rectangle, as shown in
Figure 2, is a virtual rectangle that appears in the
Sudoku main grid, and all its corners have the same
candidates. This phenomenon prevents the puzzle
from having a unique solution. Thus, unless the
deductive algorithm is provided with sufficient tools
to manage this pattern (which is usually caused by
poor puzzle design), the algorithm ends without
solving the puzzle.
On the other hand, search algorithms, such as
BT, do not encounter problems when solving the
Sudoku set with forbidden rectangle. For example,
while solving the puzzle shown in Figure 2 (A), the
solver could assume that the correct answer for the
[C,4] square is the value five. This makes it
imperative for [C,6] to take the value eight, [H,4] to
also take eight, and [H,6] to take five because these
values are the only valid remaining ones.
Furthermore, the solver could make a different
decision by assuming that the correct answer for
[C,4] is eight. In this context, the assignment value
chain varies to fulfil the Sudoku rule, and the final
result is determined by the first assumption made.
This is attributed to the algorithm’s ability to
backtrack when a conflict occurs, and to attempt
other values.
In practice, the BT search algorithm goes into
iterative recursion calls called ‘labelling’ or
‘assignment’ process (Kumar, 1992), where one of
the candidates is placed in a square, while the others
are stored locally in case the chosen value fails to be
part of the solution. The algorithm continues
assigning values to new variables provided that the
values do not violate the Sudoku rule. However, if
they do, a conflict is declared and the algorithm
aborts the current labelling process in order to
backtrack. After reversing several steps (depending
on availability and the validity of the square
candidates), the algorithm tries other candidates until
the conflict is resolved. This is the basic principle of
backtracking, which is most likely to be a ‘trial and
error’ procedure (Eppstein, 2012; Moraglio et al.,
2006). In this paper, we consider this type of search
algorithm without involving any type of deductive
techniques to enhance efficiency.
BT is one of the most classical bruteforce,
depthfirst search algorithms (Kumar, 1992;
Moraglio et al., 2006) that guarantee finding a
solution for any Sudoku set (when there is one)
because all potential candidates are examined with
respect to the puzzle rule. Forward Checking (FC) is
considered an important improvement technique for
the BT algorithm, and it has the ability of
maintaining a list of valid values for each variable to
be examined. However, it does not follow a specific
strategy for selecting squares. Thus, the square
6
1
713
7
3
61
853
9 24856
5
4
2
12
4
6
A
B
C
D
E
F
G
H
I
ReorderingVariablesusing'ContributionNumber'StrategytoNeutralizeSudokuSets
327