This commit is contained in:
2022-06-03 23:31:26 +02:00
parent 08f35f6d0d
commit 6d1f8bbc8b
5 changed files with 83 additions and 47 deletions
+2
View File
@@ -13,6 +13,8 @@ function state_game()
local function _enter(_board)
board = _board
-- lock the initial tiles
board:lock_tiles()
end
local function _draw()
+22 -14
View File
@@ -8,12 +8,14 @@ function state_loading()
"eMULATING HARDWARE",
"uNCLOGGING MEMORY BUS",
"sPINNING UP ai AGENT",
"bOOTING VIRTUAL MACHINE",
"cOLLECTING PIXELS TO BUILD TILES",
"lOADING RAY-TRACING ALGORITHM",
"sIDE-STEPPING VIRTUAL MACHINE",
"iNSTALLING BACKTRACKING WIZARD",
"eXFOLIATING PIXELS",
"sCAFFOLDING RAY-TRACING ALGORITHM",
"sWEEPING PARTICLES",
"pRESSURIZING USER INTERFACE",
"rECOMPUTING BOARD MATRIX"
"sERIALIZING BOARD MATRIX",
"bACKPORTING e2e ENCRYPTION",
}
local message = ""
@@ -32,14 +34,16 @@ function state_loading()
until board:is_valid()
printh("b: " .. time())
-- Remove tiles until randomness is unavoidable
-- Remove tiles that can be removed
local previous = {board:get_tiles_copy()} -- initial state
while true do
board:set_tiles(previous[#previous])
-- remove a random tile
repeat
removing_tile += 1
until removing_tile == 100 or board:get_tiles_copy()[iremoving_tile] ~= 0
until removing_tile == 100 or board:get_tiles_copy()[removing_tile] ~= 0
if removing_tile == 100 then
break
end
@@ -67,14 +71,12 @@ function state_loading()
end)
local function draw_tiles(board)
local w = board:get_size()
local tiles = board:get_tiles_copy()
for k,v in ipairs(tiles) do
if k<removing_tile and v > 0 then
local x,y = board:draw_coords(k)
local color = v == BLUE and 12 or 8
if color == 1 then fillp(▒) else fillp(█) end
rectfill2(x, y, w, w, color)
if k < removing_tile then
board:draw_tile(k)
end
end
end
@@ -97,7 +99,9 @@ function state_loading()
end
local function _update()
messages_x -= 2
board:lock_tiles()
messages_x -= 5
if loaded then
set_state(states.game, board)
end
@@ -105,13 +109,17 @@ function state_loading()
local function _draw()
cls()
board:draw_bg()
draw_tiles(board)
local l = print(message, 0, -100)
local y = 118+removing_tile/8
local colors = {7,6,5,5}
local ci = removing_tile\20+1
local c = colors[ci]
if not loaded then
print(messages_str, messages_x, 50, 7, 0)
rectfill2(0,y-2,127,10,0)
print(messages_str, messages_x, y, c, 0)
-- print(spinner[t()\.25%4+1], 120, 120)
end
end