summaryrefslogtreecommitdiff
path: root/cell.h
blob: 7041920c54604ef6c30f06f8362a18d418378fdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef SUDOKU_CELL_H
#define SUDOKU_CELL_H

#define CELL_VALUE_MASK(x)          (1 << ((x)-1))
#define CELL_SET_NOT(target, val)   ((target) |= CELL_VALUE_MASK(val))
#define CELL_IS_NOT(cand, val)      ((cand & CELL_VALUE_MASK(val)))

/* Description of a single cell on a sudoku board */
struct cell
{
	/* Sovled value of this cell */
	char val;

	/* Array used to determine which values this cell can NOT be.
	 * A non-zero value at index N indicates that this cell cannot have the
	 * value N + 1 */
	int not;
};

#endif /* SUDOKU_CELL_H */