Game Development Reference
In-Depth Information
size = 400/squares -- Recalculate the sizes
boxes = {} -- Reset the array
-- Create a random puzzle by filling the board
for x = 1, squares do
for y = 1, squares do
box = {Orig = math.random(0,1), X = x, Y = y, Curr = 0}
-- We set the value for that box randomly to on or off
table.insert(boxes, box)
end
end
-- Set the first row to be on
for k,v in pairs(boxes) do
if v.X == 1 then
v.Orig = 1
end
end
end
make_board()
function findnumberx(x)
-- This returns the clue for the column x
local n = {}
local c = 0
for k,v in pairs(boxes) do
if v.X == x then
if v.Orig == 1 then
c = c + 1
else
if c > 0 then
table.insert(n, tostring(c))
end
c = 0
end
end
end
if c > 0 then
table.insert(n, tostring(c))
end
return table.concat(n,",")
end
function findnumbery(y)
-- This returns the clue for the row y
Search WWH ::




Custom Search