update steps
This commit is contained in:
@@ -786,7 +786,7 @@ void step3(void) {
|
||||
} else if (key == KeypadKey::pound) {
|
||||
// submit
|
||||
if (entered_string != answer_string) {
|
||||
strike("Entered answer is not correct! (step 3, puzzle 7)");
|
||||
strike("Incorrect answer!");
|
||||
} else {
|
||||
solved_puzzles++;
|
||||
solved_correctly = true;
|
||||
@@ -805,7 +805,7 @@ void step3(void) {
|
||||
lcd_print(&lcd, entered_string.c_str());
|
||||
}
|
||||
if (get_module_time() <= 0) {
|
||||
strike("Ran out of time! (step 3, puzzle 7)");
|
||||
strike("Ran out of time!");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -873,7 +873,7 @@ void step3(void) {
|
||||
} else if (key == KeypadKey::pound) {
|
||||
// submit
|
||||
if (entered_string != answer_num) {
|
||||
strike("Entered answer is not correct! (step 3, puzzle 7)");
|
||||
strike("Incorrect answer!");
|
||||
} else {
|
||||
solved_times++;
|
||||
}
|
||||
@@ -891,7 +891,7 @@ void step3(void) {
|
||||
lcd_print(&lcd, entered_string.c_str());
|
||||
}
|
||||
if (get_module_time() <= 0) {
|
||||
strike("Ran out of time! (step 3, puzzle 7)");
|
||||
strike("Ran out of time!");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+19
-18
@@ -1,8 +1,8 @@
|
||||
#include "step4.h"
|
||||
|
||||
#define ONE_SECOND_TIME 60'000
|
||||
#define THREE_SECOND_TIME 60'000
|
||||
#define SIX_SECOND_TIME 60'000
|
||||
#define ONE_SECOND_TIME 90'000
|
||||
#define THREE_SECOND_TIME 90'000
|
||||
#define SIX_SECOND_TIME 90'000
|
||||
|
||||
static const char *TAG = "step4";
|
||||
|
||||
@@ -70,31 +70,27 @@ void step4(void) {
|
||||
while (times < 4) {
|
||||
tone = tone_dist(gen);
|
||||
// tone = 2;
|
||||
while (get_pressed_button(nullptr)) vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
play_raw(TONE_FILES[tone]);
|
||||
|
||||
bool correct = false;
|
||||
switch (tone % 3) {
|
||||
case 0:
|
||||
if (one_second()) {
|
||||
times++;
|
||||
clean_bomb();
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
correct = one_second();
|
||||
break;
|
||||
case 1:
|
||||
if (three_second()) {
|
||||
times++;
|
||||
clean_bomb();
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
correct = three_second();
|
||||
break;
|
||||
case 2:
|
||||
if (six_second()) {
|
||||
times++;
|
||||
clean_bomb();
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
correct = six_second();
|
||||
break;
|
||||
}
|
||||
if (correct) {
|
||||
times++;
|
||||
clean_bomb();
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
}
|
||||
@@ -258,6 +254,8 @@ static bool three_second() {
|
||||
|
||||
bool was_high = (tone / 3) == 1;
|
||||
|
||||
|
||||
|
||||
rng_leds();
|
||||
write_leds();
|
||||
int red_led_count = 0;
|
||||
@@ -277,6 +275,9 @@ static bool three_second() {
|
||||
(lcd_number >> 1) & 1,
|
||||
(lcd_number >> 0) & 1
|
||||
);
|
||||
if (!was_high) {
|
||||
correct_switches = (~correct_switches) & 0b1111;
|
||||
}
|
||||
|
||||
uint8_t correct_button_mask = 0b1110;
|
||||
uint8_t correct_buttons = four_bit_flag(
|
||||
|
||||
@@ -88,24 +88,36 @@ void step5(void) {
|
||||
int solved_times = 0;
|
||||
|
||||
new_puzzle();
|
||||
int strike_time = xTaskGetTickCount();
|
||||
bool striked = false;
|
||||
while(solved_times < 3) {
|
||||
// for every bit in the answer-
|
||||
set_module_sseg_raw(display_map);
|
||||
if (get_pressed_keypad(&key)) {
|
||||
lcd_clear(&lcd);
|
||||
char c = char_of_keypad_key(key);
|
||||
// ESP_LOGI(TAG, "Pressed: %c", c);
|
||||
if (c == answer_char) {
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
solved_times++;
|
||||
if (solved_times < 3) {
|
||||
clean_bomb();
|
||||
new_puzzle();
|
||||
} else {
|
||||
uint8_t display_tmp[4] = {0b00000000, 0b00000000, 0b00000000, 0b00000000};
|
||||
set_module_sseg_raw(display_tmp);
|
||||
}
|
||||
} else {
|
||||
strike_time = xTaskGetTickCount();
|
||||
striked = true;
|
||||
strike("Incorrect Character!");
|
||||
}
|
||||
}
|
||||
|
||||
if (xTaskGetTickCount() - strike_time > pdMS_TO_TICKS(5000)) {
|
||||
striked = false;
|
||||
lcd_clear(&lcd);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "../drivers/wires.h"
|
||||
#include "../drivers/game_timer.h"
|
||||
#include "../drivers/leds.h"
|
||||
#include "../drivers/speaker.h"
|
||||
#include "../helper.h"
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
#include <map>
|
||||
|
||||
@@ -40,7 +40,7 @@ void step6(void) {
|
||||
if (correct) {
|
||||
return;
|
||||
} else {
|
||||
strike("Not all wires are cut!");
|
||||
strike("Not all wires cut!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user