40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
#ifndef WIRES_PUZZLE_H
|
|
#define WIRES_PUZZLE_H
|
|
|
|
#include <stdint.h>
|
|
#include <esp_random.h>
|
|
#include <string.h>
|
|
#include "esp_vfs_fat.h"
|
|
|
|
#define NUM_COLORS 6
|
|
#define NUM_WIRES 8
|
|
|
|
typedef enum {
|
|
red = 0,
|
|
yellow = 1,
|
|
green = 2,
|
|
blue = 3,
|
|
black = 4,
|
|
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 */ |