From 2ac2e353c37b67862ed8fb49778f6e15f109686a Mon Sep 17 00:00:00 2001 From: JC Date: Sun, 30 Jul 2023 20:13:27 -0500 Subject: [PATCH] Rename rects to cells --- source/main.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/main.lua b/source/main.lua index 2057169..7bb6ef3 100644 --- a/source/main.lua +++ b/source/main.lua @@ -4,12 +4,12 @@ local gfx = playdate.graphics local WIDTH = 12 local HEIGHT = 7 -local rects = {} +local cells = {} for i=1, WIDTH do - rects[i] = {} + cells[i] = {} for j=1, HEIGHT do r = pd.geometry.rect.new(32 * (i-1), 32 * (j-1), 32, 32) - rects[i][j] = { rect = r, live = false } + cells[i][j] = { cell = r, live = false } end end @@ -22,7 +22,7 @@ local running = false function playdate.update() if not running then -- automata state setup - for i,row in ipairs(rects) do + for i,row in ipairs(cells) do for j,r in ipairs(row) do if r.live then gfx.setColor(gfx.kColorBlack) @@ -30,9 +30,9 @@ function playdate.update() gfx.setColor(gfx.kColorWhite) end - gfx.fillRect(r.rect) + gfx.fillRect(r.cell) gfx.setColor(gfx.kColorBlack) - gfx.drawRect(r.rect) + gfx.drawRect(r.cell) end end @@ -46,7 +46,7 @@ function playdate.update() elseif playdate.buttonJustPressed("down") then y = math.min(HEIGHT, y + 1) elseif playdate.buttonJustPressed("a") then - rects[x][y].live = not rects[x][y].live + cells[x][y].live = not cells[x][y].live elseif playdate.buttonJustPressed("b") then running = true end -- 2.20.1