-
Notifications
You must be signed in to change notification settings - Fork 0
LED Matrix 64x64
Peter M. Lugha edited this page Dec 6, 2025
·
1 revision
Every bn-pixel can behave like a cell, capable of state, reproduction, mutation, memory & death.
function stepLife(){
const next=[];
for(let y=0;y<64;y++){
for(let x=0;x<64;x++){
let id=y*64+x;
let neighbors=0;
for(let dy=-1;dy<=1;dy++){
for(let dx=-1;dx<=1;dx++){
if(dx||dy){
let ny=(y+dy+64)%64;
let nx=(x+dx+64)%64;
let nid=ny*64+nx;
if(state[nid]) neighbors++;
}
}
}
next[id] = state[id]
? (neighbors==2||neighbors==3) // survives
: (neighbors==3); // birth
}
}
state = next;
renderState();
}
Features:
| Trait | Behaviour |
|---|---|
| 💠 Birth | 3 illuminated neighbors |
| 🔥 Death | under/over-population |
| 🌀 Mutation | probability + shader offset |
| 🌿 Growth cycle | generations layered w/ color aging |