M7U5ZEUVNYYZFU2ACBFL7DSTOQHQQB4IYLWO2BNPWIA4VKF5KULQC generate_sum_grid = function()-- a sum grid is fully characterized by 4 numbersChar = {data = {{ math.random(1,9), math.random(1,9) },{ '', ''},},row_totals = { '', '' },}Char.col_totals = {math.random(Char.data[1][1]+1,10),math.random(Char.data[1][2]+1,10)}end
create_problem = function()local s = SolutionProblem = {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]end
new = function()generate()solve()create_problem()end
generate = function()-- a sum grid is fully characterized by 4 numbersChar = {data = {{ math.random(1,9), math.random(1,9) },{ '', ''},},row_totals = { '', '' },}Char.col_totals = {math.random(Char.data[1][1]+1,10),math.random(Char.data[1][2]+1,10)}end