local HEIGHT <const> = 14
local CELL_SIZE <const> = 16
+--- refresh / generation rate during runtime
+local refreshRate = 2
+
+local INPUT_HANDLERS <const> = {
+ cranked = function(change, acceleratedChange)
+ if change > 0 then
+ refreshRate = math.min(20, refreshRate + 1)
+ elseif change < 0 then
+ refreshRate = math.max(1, refreshRate - 1)
+ end
+ end
+}
+
+pd.inputHandlers.push(INPUT_HANDLERS)
+
-- Convenience function for iterating over 8 neighbors
function neighbors(g1, x, y)
-- center tiles
local y = 1
local running = false
+
function playdate.update()
if playdate.buttonJustPressed("b") then
running = not running
else
-- running
-- Make running less epileptic while letting interaction remain smooth
- pd.display.setRefreshRate(2)
+ pd.display.setRefreshRate(refreshRate)
draw(cells)
cells = generation(cells)
end