From 529703b7e42459358f314d6b8e2b03b828385f09 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Fri, 1 Jul 2022 20:20:57 +0200 Subject: [PATCH] Fixed bug in consecutive count --- board.lua | 12 +++++++----- main.lua | 4 ++-- states/loading.lua | 4 +++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/board.lua b/board.lua index 04cd6b1..2c10604 100644 --- a/board.lua +++ b/board.lua @@ -144,17 +144,19 @@ function Board.new() end, count_consecutives = function(self, line) - local count = 0 + local top = 0 + local current = 0 local last = 0 for v in all(line) do if v ~= last then - last = 0 - else + top = max(current, top) + current = 1 last = v - count += 1 + else + current += 1 end end - return count + return top end, -- diff --git a/main.lua b/main.lua index aa0b7df..257d652 100644 --- a/main.lua +++ b/main.lua @@ -101,9 +101,9 @@ function _init() printh(" ") printh("*************") printh(" ") - local date = stat(80)..stat(81)..stat(82)..stat(85) + local date = stat(80)..stat(81)..stat(82) -- srand(date) - srand(20227149) + -- srand(20227149) printh(date) mouse_x = 0 mouse_y = 0 diff --git a/states/loading.lua b/states/loading.lua index a29353e..b5f8176 100644 --- a/states/loading.lua +++ b/states/loading.lua @@ -14,6 +14,8 @@ function state_loading() "sCAFFOLDING RAY-TRACING ALGORITHM", "sWEEPING PARTICLES", "pRESSURIZING USER INTERFACE", + "sHAKING RED AND BLUE PAINT BUCKETS", + "gATHERING GRAVITY", "sERIALIZING BOARD MATRIX", "bACKPORTING e2e ENCRYPTION", } @@ -102,7 +104,7 @@ function state_loading() local function _update() board:lock_tiles() - messages_x -= 5 + messages_x -= 4 if loaded then set_state(states.game, board) end