Rename rects to cells
authorJC <dev@jacobcasper.com>
Mon, 31 Jul 2023 01:13:27 +0000 (20:13 -0500)
committerJC <dev@jacobcasper.com>
Mon, 31 Jul 2023 01:13:27 +0000 (20:13 -0500)
source/main.lua

index 2057169..7bb6ef3 100644 (file)
@@ -4,12 +4,12 @@ local gfx <const> = playdate.graphics
 local WIDTH <const> = 12
 local HEIGHT <const> = 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