// A puzzle_options_t is a set of possible tile values that can live somewhere // in the puzzle. // // It has the interface of Set. // // Only values '1' through '9' are representable. Trying to add any other value // to the set will silently fail. #ifndef PUZZLE_OPTIONS_H #define PUZZLE_OPTIONS_H #include #include #include "tile.h" typedef struct { uint16_t bitfield; } puzzle_options_t; // Create a blank puzzle options set. void puzzle_options_init(puzzle_options_t* puzzle_options); // Add a tile to a puzzle options set. void puzzle_options_add(puzzle_options_t* puzzle_options, tile_t tile); // Remove a tile from a puzzle options set. bool puzzle_options_remove(puzzle_options_t* puzzle_options, tile_t tile); // Return true if a puzzle options set contains this tile bool puzzle_options_contains(puzzle_options_t* puzzle_options, tile_t tile); // Count the tiles in this puzzle options set. uint8_t puzzle_options_count(puzzle_options_t* puzzle_options); // Check if a puzzle options set is empty. // // Equivalent to puzzle_options_count(...) == 0. bool puzzle_options_is_empty(puzzle_options_t* puzzle_options); #endif