Fixed bug in consecutive count

This commit is contained in:
Simon Cambier 2022-07-01 20:20:57 +02:00
parent 0276d70de3
commit 529703b7e4
3 changed files with 12 additions and 8 deletions

View File

@ -144,17 +144,19 @@ function Board.new()
end, end,
count_consecutives = function(self, line) count_consecutives = function(self, line)
local count = 0 local top = 0
local current = 0
local last = 0 local last = 0
for v in all(line) do for v in all(line) do
if v ~= last then if v ~= last then
last = 0 top = max(current, top)
else current = 1
last = v last = v
count += 1 else
current += 1
end end
end end
return count return top
end, end,
-- --

View File

@ -101,9 +101,9 @@ function _init()
printh(" ") printh(" ")
printh("*************") printh("*************")
printh(" ") printh(" ")
local date = stat(80)..stat(81)..stat(82)..stat(85) local date = stat(80)..stat(81)..stat(82)
-- srand(date) -- srand(date)
srand(20227149) -- srand(20227149)
printh(date) printh(date)
mouse_x = 0 mouse_x = 0
mouse_y = 0 mouse_y = 0

View File

@ -14,6 +14,8 @@ function state_loading()
"sCAFFOLDING RAY-TRACING ALGORITHM", "sCAFFOLDING RAY-TRACING ALGORITHM",
"sWEEPING PARTICLES", "sWEEPING PARTICLES",
"pRESSURIZING USER INTERFACE", "pRESSURIZING USER INTERFACE",
"sHAKING RED AND BLUE PAINT BUCKETS",
"gATHERING GRAVITY",
"sERIALIZING BOARD MATRIX", "sERIALIZING BOARD MATRIX",
"bACKPORTING e2e ENCRYPTION", "bACKPORTING e2e ENCRYPTION",
} }
@ -102,7 +104,7 @@ function state_loading()
local function _update() local function _update()
board:lock_tiles() board:lock_tiles()
messages_x -= 5 messages_x -= 4
if loaded then if loaded then
set_state(states.game, board) set_state(states.game, board)
end end