wip optimizing render

This commit is contained in:
2022-12-19 16:00:38 +01:00
parent e03f7db3ba
commit 2a42746e1c
7 changed files with 119 additions and 86 deletions

View File

@ -91,6 +91,15 @@ function conwayRules(cell, neighbors) {
return cell;
}
// Get the next evolution of a cell according to
// Conway's game of life rules
function servietteRules(cell, neighbors) {
// loneliness rule
if (cell === 0 && [2, 3, 4].find((x) => x == neighbors)) return 1;
// the cell remains the same if none apply
return 0;
}
// variation of the game of life where a
// cell comes to live if 6 neigbor cells are alive
function highLifeRules(cell, neighbors) {
@ -200,6 +209,7 @@ export {
lonelinessRules,
threebornRules,
highLifeRules,
servietteRules,
evolve1d,
evolve2d,
};