sudoku_bat/solver/cellset.h

40 lines
835 B
C
Raw Normal View History

2024-05-25 23:08:47 +00:00
// A cellset_t is a list of cells. (without duplicates)
//
// This is a very thin wrapper over an array of cells.
//
// You're encouraged to use the underlying representation directly by accessing
// the cells field.
#ifndef CELLSET_H
#define CELLSET_H
#include "shared.h"
#include <stdint.h>
typedef struct {
uint8_t count;
uint8_t cells[N_CELLS];
} cellset_t;
// Create an empty cellset_t.
void cellset_init(cellset_t* cells);
// Add a cell to the cellset_t.
void cellset_add(
cellset_t* row,
uint8_t cell
);
// Add a cell to the cellset_t, unless the new value equals exclude, in which
// case nothing is done.
//
// (This operation is specifically useful in building the interference map.
// See interference.h.)
void cellset_add_exclude(
cellset_t* row,
uint8_t exclude,
uint8_t cell
);
#endif