local running = false
+function draw(cells)
+ for i,row in ipairs(cells) do
+ for j,r in ipairs(row) do
+ if r.live then
+ gfx.setColor(gfx.kColorBlack)
+ else
+ gfx.setColor(gfx.kColorWhite)
+ end
+
+ gfx.fillRect(r.cell)
+ gfx.setColor(gfx.kColorBlack)
+ gfx.drawRect(r.cell)
+
+ end
+ end
+end
function playdate.update()
if not running then
-- automata state setup
- for i,row in ipairs(cells) do
- for j,r in ipairs(row) do
- if r.live then
- gfx.setColor(gfx.kColorBlack)
- else
- gfx.setColor(gfx.kColorWhite)
- end
-
- gfx.fillRect(r.cell)
- gfx.setColor(gfx.kColorBlack)
- gfx.drawRect(r.cell)
-
- end
- end
+ draw(cells)
if playdate.buttonJustPressed("right") then
x = math.min(WIDTH, x + 1)
end
else
-- running
+ draw(cells)
end
end