ok, I think this works
The final desirable flow turns out to be: d[1][1] -> row_total[1], col_total[1] -> d[1][2], d[2][1] -> d[2][2] -> the remaining totals Phew! This may well be the only possible way that works, modulo symmetry. I've tested manually that: the generated grids are always consistent row 2 and column 2 are never more than 10 row 2 and column 2 _do_ go to 10 sometimes
This commit is contained in:
parent
69b803b9f2
commit
ddaebb4496
|
@ -15,11 +15,11 @@ generate = function()
|
|||
g.col_totals[1] = math.random(d11+1,10)
|
||||
-- loiter()
|
||||
g.data[1][2] = g.row_totals[1] - d11
|
||||
g.data[2][1] = g.col_totals[1]-d11
|
||||
g.data[2][1] = g.col_totals[1] - d11
|
||||
-- loiter()
|
||||
g.col_totals[2] = math.random(g.data[2][1]+1,10)
|
||||
-- loiter()
|
||||
g.data[2][2] = g.col_totals[2]-g.data[1][2]
|
||||
local max = math.max(g.data[1][2], g.data[2][1])
|
||||
g.data[2][2] = math.random(1, 10-max)
|
||||
-- loiter()
|
||||
g.col_totals[2] = g.data[1][2] + g.data[2][2]
|
||||
g.row_totals[2] = g.data[2][1] + g.data[2][2]
|
||||
end
|
Loading…
Reference in New Issue