Slicing and Slotting
Although it is not conceptually the next-easiest strategy, Slicing and Slotting is the second-easiest strategy to spot and use. Slicing and slotting is looking for all occurrences of a certain value, and seeing if the locations of the value throughout the grid force a cell to be the only one in its block to be able to contain that value. Figure 2 illustrates this quite well. Because the 2 cannot occur in the first and third columns, and in the third row, and there is only one remaining empty cell outside of these rows or columns in the first block, the 2 must occupy that empty position.
Programming Slicing and Slotting is a somewhat less straightforward matter. One effective way to do so is to loop through all empty cells, and within this loop go though all values x not assigned in that cell’s block. Now, check all rows and columns going through the block for each of these x. If the columns and rows, combined with the already filled cells, account for all cells in the block but that empty cell, then that cell’s value can be set to x, and the strategy has completed successfully. Otherwise, the strategy continues until it finds a cell on which to apply the strategy, or it moves on to the next solving technique.