CHAPTER 11

image

Implementing “XY-chain”

This strategy is an extension of Y-wing. Therefore, it is not surprising that the two strategies share a significant amount of code.

The top-level strategy function is xy_chain() (see Listing 11-1). Like y_wing(), its purpose is to provide a standard f_ptr_t interface (see def.h in Listing 3-1) to the function pairs_find() (see Listings 10-3, 10-4, 10-5, and 10-6). pairs_find() executes xy_chain_digit() (see Listing 11-2) for each candidate number, which in turn uses xy_chain_step() (see Listing 11-4) to follow the chain of cells that is at the core of the XY-chain strategy. To determine what area of the Sudoku ...

Get Sudoku Programming with C now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.