Published
Edited
Oct 5, 2022
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rules = ({
rule30: (left, center, right) => left ^ (center || right),
rule90: (left, center, right) => left ^ right,
rule110: (left, center, right) => {
const currPattern = `${left}${center}${right}`;

switch (currPattern) {
case "110":
case "101":
case "011":
case "010":
case "001":
return 1;

default:
// 111, 100, 000
return 0;
}
},
rule184: (left, center, right) => {
const currPattern = `${left}${center}${right}`;

switch (currPattern) {
case "111":
case "101":
case "100":
case "011":
return 1;

default:
// 110, 010, 001, 000
return 0;
}
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// The can be updated only through set and get functions.
// In can only be invalidated when initialRows (inital conditions) change.
// This help in retaining state when toggling 'animate'
store = {
let cells = initialRows.slice();

const set = (newCells) => {
if (Array.isArray(newCells)) {
cells = newCells.slice();
}
};
const get = () => {
return cells.slice();
};

return {
set,
get
};
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more