SudokuLua/sudoku/utils.lua

29 lines
469 B
Lua

function find(array, element)
local index = 0
for i = 1, #array do
if array[i] == element then
index = i
break
end
end
return index
end
function showBoard(board)
for row = 1, 9 do
print(table.concat(board[row], " "))
end
end
function cloneBoard(b)
local c = {}
for i = 1, 9 do
c[i] = {}
for j = 1, 9 do
c[i][j] = b[i][j]
end
end
return c
end