function state_game() local board local selected_id = 1 local timer_clue = 0 local function show_clues() local issues = board:get_issues(true) for issue in all(issues) do local type, err, row, pos, other = unpack(issue) if err == "identical" and count(row,0)>0 then goto continue end printh(type .. " " .. err .. " " .. pos) ::continue:: end end local function draw_selected_tile() local x, y = board:draw_coords(selected_id) local w = board:get_tile_width() fillp(▒) rect2(x-1, y-1, w+2, w+2, 6) fillp(█) end local function _enter(_board) board = _board -- lock the initial tiles board:lock_tiles() end local function _leave() -- stopcoroutine(show_clues) end local function _draw() cls() board:draw() draw_selected_tile() end local function _update() timer_clue += 1 if timer_clue % 120 == 0 then show_clues() end local size = board:get_size() local x, y = board:idx_xy(selected_id) if btnp(UP) then y -= 1 elseif btnp(DOWN) then y += 1 elseif btnp(LEFT) then x -= 1 elseif btnp(RIGHT) then x += 1 end if btnp(BTN_O) then board:try_flip_tile(selected_id) end if (x<1) x=size if (x>size) x=1 if (y<1) y=size if (y>size) y=1 selected_id = board:xy_idx(x, y) end return { _enter = _enter, _update = _update, _draw = _draw, _leave = _leave } end