CHAPTER 10

image

Implementing “Y-wing”

The Y-wing strategy is quite complex, which is reflected in the complexity of its implementation.

Key to the implementation of Y-wing (and of XY-chain, as you will see in Chapter 11) are two arrays defined for convenience in their own separate modules (see Listing 10-1).

Listing 10-1. pairs_data.c

/* pairs_data.c * * Copyright (C) 2015  Giulio Zambon  - http://zambon.com.au/ * */#include "pairs_data.h"char n_x_pairs[10][10] = {{0}};char *x_pairs[10][10][3] = {{{0}}};

n_x_pairs counts the number of pairs for every possible combination of two candidate numbers and x_pairs stores the coordinates of the cells that ...

Get Sudoku Programming with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.