CHAPTER 7
Implementing “Box-Line”
As with most strategies, you implement “box-line” with two functions: one general that conforms to the type f_ptr_t as defined in def.h and one to handle an individual unit. The general function, box_line() (see Listing 7-1), executes box_line_unit() (see Listings 7-2 and 7-3) for each possible row and column of the Sudoku.
box_line()
box_line() is pretty obvious, but notice that it passes a flag to box_line_unit()to distinguish between rows and columns. It is actually not strictly necessary, but it makes the log entries clearer.
Listing 7-1. box_line.c
/* box_line.c * * Copyright (C) 2015 Giulio Zambon -
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.