sum-grid.love/0028-create_problem

15 lines
333 B
Plaintext

create_problem = function()
local s = Solution
Problem = {
row_totals = {s.row_totals[1], s.row_totals[2]},
col_totals = {s.col_totals[1], s.col_totals[2]},
data = {
{'', ''},
{'', ''},
},
}
local x = math.random(1, 2)
local y = math.random(1, 2)
Problem.data[y][x] = s.data[y][x]
Problem.x, Problem.y = x, y
end