blk_box_tc/main/steps/wires_puzzle.h

39 lines
1.1 KiB
C

#ifndef WIRES_PUZZLE_H
#define WIRES_PUZZLE_H
#include <stdint.h>
#include <esp_random.h>
#include "drivers/sd.h"
#define NUM_COLORS 6
#define NUM_WIRES 8
typedef enum {
wire_red = 0,
wire_yellow = 1,
wire_green = 2,
wire_blue = 3,
wire_black = 4,
wire_white = 5,
} WireColor;
void solve_wires(WireColor* wires, bool* out_cut);
void generate_new_wires(WireColor* wires);
void cut_to_string(bool* cut, char* out_cut_string);
void wires_to_string(WireColor* wires, char* out_wires_string);
void string_to_wires(char* wires_string, WireColor* out_wires);
void save_wires_to_sd_card(WireColor* wires);
void load_wires_from_sd_card(WireColor* out_wires);
/// @brief Fills the array with 6 random WiresColors.
/// @param wires the array of len >= 6 to be populated with random colors
void generate_new_wires(WireColor* wires);
/// @brief Solves the wires puzzle, setting `out_cut` according to which wires are cut.
/// @param wires the array of len >= 6 as input to the solver
/// @param out_cut the output array of len >= 6 for which wires to cut
void solve_wires(WireColor* wires, bool* out_cut);
#endif /* WIRES_PUZZLE_H */