Primordial
Thirty-two by eight is not much of a universe. It turns out to be enough.
About this flow
| System | AWTRIX NG Scripts |
|---|---|
| AWTRIX version | AWTRIX NG |
| Topic | Miscellaneous |
| Built by | Galadril |
| File | EUa3mZzpeRrG.ax · 1.8 KB |
| Icons | — |
| Published | 9 Sep 2026 · updated 9 Sep 2026 |
| Downloads | 15 |
Is this your flow?
If you created this flow, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.
Flow description
Every cell counts its eight neighbours and obeys two rules that fit in a sentence…
Nobody is steering. There is no goal state, no score, nothing being optimised.
And yet for thirty seconds at a time, things move.
Conway's Game of Life
EUa3mZzpeRrG.ax
# @name Primordial
# @desc Conway's Game of Life, seeded by the clock
# @author Galadril
# @version 1.0
# @config speed slider "Generation ms" default=150 min=60 max=600
import math
class Primordial
var g,prev,t,pop,stall,ms
def init()
self.ms=store.get("speed",150)
self._seed()
end
def _seed()
var s=1
var h=hour()
if h>=0
s=h*60+minute()+1
end
if h<0
s=now_ms()%1440+1
end
self.g=[]
var x=0
while x<32
s=(s*75+74)%65537
self.g.push(s%256)
x+=1
end
self.prev=self.g
self.t=0
self.pop=-1
self.stall=0
end
def _get(gg,x,y)
var xi=x%32
if xi<0
xi+=32
end
var yi=y%8
if yi<0
yi+=8
end
return (gg[xi]>>yi)&1
end
def _step()
var out=[]
var x=0
while x<32
var col=0
var y=0
while y<8
var n=self._get(self.g,x-1,y-1)+self._get(self.g,x,y-1)+self._get(self.g,x+1,y-1)+self._get(self.g,x-1,y)+self._get(self.g,x+1,y)+self._get(self.g,x-1,y+1)+self._get(self.g,x,y+1)+self._get(self.g,x+1,y+1)
var a=self._get(self.g,x,y)
var live=0
if a==1
if n==2
live=1
end
if n==3
live=1
end
end
if a==0
if n==3
live=1
end
end
col=col|(live<<y)
y+=1
end
out.push(col)
x+=1
end
self.prev=self.g
self.g=out
var p=0
x=0
while x<32
var c=self.g[x]
var y2=0
while y2<8
if ((c>>y2)&1)==1
p+=1
end
y2+=1
end
x+=1
end
if p==self.pop
self.stall+=1
end
if p!=self.pop
self.stall=0
end
self.pop=p
if self.stall>=12
self._seed()
return
end
if p==0
self._seed()
end
end
def on_button(b)
if b=="select"
self._seed()
end
end
def duration()
return 25000
end
def draw()
clear()
var now=now_ms()
if now-self.t>self.ms
self.t=now
self._step()
end
var x=0
while x<32
var c=self.g[x]
var o=self.prev[x]
var y=0
while y<8
if ((c>>y)&1)==1
var col=0x1E6B2E
if ((o>>y)&1)==0
col=0x6FE08A
end
pixel(x,y,col)
end
y+=1
end
x+=1
end
end
end
return Primordial()
Install it on your AWTRIX NG
Add this flow to your AWTRIX NG. It will start appearing on your display after installation.
Unable to connect? Download the flow and add it in the Scripts section of your AWTRIX. Advanced users can also use this command:
Discussion 0
Ask a question, suggest a change or share how you use it.
No comments yet. Start the conversation.
More flows for AWTRIX NG Scripts or Miscellaneous
Something wrong with this flow? Report it.
Have an idea?
Sign in to ask questions and join the conversation.