SudokuLua/ui/logic.lua
2020-05-22 05:29:43 +04:30

43 lines
1.0 KiB
Lua

function displaySearchSpace()
local s = buildSearchSpace(uiBoard[2])
for x = 1, 9 do
for y = 1, 9 do
for z = 1, 9 do
smallNumbersVal[x][y][z] = false
end
for _, v in ipairs(s[y][x]) do
smallNumbersVal[x][y][v] = true
end
end
end
messages = scheck(uiBoard[2])
end
function checkBoard()
messages = scheck(uiBoard[2])
end
function loadLastBoard()
board = {}
board[1], board[2] = loadBoard("lastBoard.txt")
uiBoard[1] = cloneBoard(board[1])
uiBoard[2] = cloneBoard(board[2])
uiBoard[3] = cloneBoard(board[2])
messages[1] = 'loaded: "lastBoard.txt"'
end
function saveCurrentBoard()
local f = io.open("lastBoard.txt", "w")
for row = 1, 9 do
f:write(table.concat(uiBoard[1][row], " "))
f:write("\n")
end
f:write("\n")
for row = 1, 9 do
f:write(table.concat(uiBoard[2][row], " "))
f:write("\n")
end
f:close()
messages[1] = 'saved: "lastBoard.txt"'
end