51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
#ifndef STEP_3_HPP
|
|
#define STEP_3_HPP
|
|
|
|
#include <random>
|
|
#include "../drivers/bottom_half.h"
|
|
#include <iostream>
|
|
#include "../drivers/game_timer.h"
|
|
#include <set>
|
|
|
|
static const char *STEP3_TAG = "step3";
|
|
|
|
std::random_device rd;
|
|
std::mt19937 gen(rd());
|
|
std::uniform_int_distribution<> puzzle_dist(0, 7);
|
|
std::uniform_int_distribution<> puzzle_zero_dist(0, 15);
|
|
std::uniform_int_distribution<> led_dist(0, 20);
|
|
|
|
void step3(void) {
|
|
set_module_time(3000);
|
|
|
|
// int puzzle = puzzle_dist(gen);
|
|
int puzzle = 0;
|
|
switch (puzzle) {
|
|
case 0:
|
|
lcd_print(&lcd, "Clear");
|
|
|
|
int green_indicators = puzzle_zero_dist(gen);
|
|
std::set<int> indicators;
|
|
|
|
while (indicators.size() < green_indicators) {
|
|
indicators.insert(led_dist(gen));
|
|
}
|
|
|
|
for (std::set<int>::iterator it = indicators.begin(); it != indicators.end(); it++) {
|
|
ESP_ERROR_CHECK(led_strip_set_pixel(leds, *it, 0, 60, 0));
|
|
}
|
|
|
|
while (1) {
|
|
if (get_module_time() <= 0) {
|
|
ESP_LOGI(STEP3_TAG, "switch state: %i", get_switch_state(0));
|
|
// get_switch_state();
|
|
}
|
|
vTaskDelay(pdMS_TO_TICKS(10));
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* STEP_3_HPP */ |