Skip to content

Commit

Permalink
Repeatedly increment number of starting moves
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed Apr 23, 2023
1 parent 52373b3 commit d86a54f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions keyboards/winry/winry25tc/keymaps/lightsout/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ void refresh_leds(void) {
rgblight_set();
}

#define INITIAL_MOVES 1
uint8_t initial_moves = 1;

void start_game(void) {
rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
for (uint8_t i = 0; i < INITIAL_MOVES; i++) {
for (uint8_t i = 0; i < initial_moves; i++) {
do_move(random() % 5, random() % 5);
}
refresh_leds();
Expand All @@ -138,6 +138,7 @@ bool won = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
if (won) {
initial_moves++;
won = false;
start_game();
} else {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/winry/winry25tc/keymaps/lightsout/readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Lights Out game

Implements a "lights out" mode as per https://en.m.wikipedia.org/wiki/Lights_Out_(game) with a single move having been played on start. On completion of the game, the Rainbow Swirl pattern is displayed. If another key is then pressed, the game resets.
Implements a "lights out" mode as per https://en.m.wikipedia.org/wiki/Lights_Out_(game) with a single move having been played on start. On completion of the game, the Rainbow Swirl pattern is displayed. If another key is then pressed, the game resets, with the initial number of moves incremented by one.

0 comments on commit d86a54f

Please sign in to comment.