Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created July 31, 2021 06:54
Show Gist options
  • Select an option

  • Save YonatanKra/0840f38bb3a75c4f3aa5f225e61cb076 to your computer and use it in GitHub Desktop.

Select an option

Save YonatanKra/0840f38bb3a75c4f3aa5f225e61cb076 to your computer and use it in GitHub Desktop.
const matrices = {
last: null,
current: null
};
matrices.current = new Array(MATRIX_DIMENSIONS.height).fill(0)
.map(() => {
return generateWhiteNoise(MATRIX_DIMENSIONS.width, WHITE_LEVEL);
});
while (areMatricesDifferent(matrices.current, matrices.last) || someCounter > someLimit) {
matrices.last = matrices.current;
matrices.current = cellularAutomaton(matrices.last);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment