06.09.2021 Views

Mind, Body, World- Foundations of Cognitive Science, 2013a

Mind, Body, World- Foundations of Cognitive Science, 2013a

Mind, Body, World- Foundations of Cognitive Science, 2013a

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

this location. The affected locations are shaded dark grey in Figure 8-4. One can<br />

propagate the “there can be only one” constraint through these locations, removing<br />

the digit 5 as a possible label for any <strong>of</strong> them.<br />

This constraint can be propagated iteratively through the puzzle. During one<br />

iteration, any cell with a unique label can be used to eliminate that label from all<br />

<strong>of</strong> the other cells that it controls (e.g., as in Figure 8-4). When this constraint is<br />

applied in this way, the result may be that some new cells have unique labels. In this<br />

case the constraint can be applied again, from these newly unique cells, to further<br />

disambiguate the Sudoku puzzle.<br />

The “there can be only one” constraint is important, but it is not powerful enough<br />

on its own to solve any but the easiest Sudoku problems. This means that other constraints<br />

must be employed as well. Another constraint is called “last available label,”<br />

and is illustrated in Figure 8-5.<br />

Figure 8-5A illustrates one <strong>of</strong> the cages <strong>of</strong> the Figure 8-3 Sudoku problem partway<br />

through being solved (i.e., after some iterations <strong>of</strong> “there can be only one”).<br />

The cells containing a single number have been uniquely labelled. The other cells<br />

still have more than one possible label, shown as multiple digits within the cell.<br />

Note the one cell at the bottom shaded in grey. It has the possible labels 1, 3, 5, and<br />

9. However, this cell has the “last available label” <strong>of</strong> 9—the label 9 is not available<br />

in any other cell in the cage. Because a 9 is required to be in this cage, this means<br />

that this label must be assigned here and the cell’s other three possible labels can<br />

be removed. Note that when this is done, the “last available label” constraint applies<br />

to a second cell (shown in grey in Figure 8-5B), meaning that it can be uniquely<br />

assigned the label 1 by applying this constraint a second time.<br />

3 5<br />

3 5<br />

1<br />

5<br />

7 6<br />

8<br />

3<br />

9<br />

1 5<br />

2 4<br />

3 5<br />

A<br />

7 6<br />

8<br />

3 5 1 5<br />

2 9 4<br />

B<br />

Figure 8-5. The “last available label” constraint.<br />

Seeing and Visualizing 373

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!