Public
Edited
Dec 15, 2022
Insert cell
Insert cell
Insert cell
input = FileAttachment("AoC_day14.txt").text()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
paths = parsePaths(input)
Insert cell
grid = createGrid(paths)
Insert cell
{
let i = 0;
for (const g of grid.simulate()) {
if (++i % 40 === 0) {
yield g.visualise();
}
}
}
Insert cell
{
let grains;
for (const g of grid.simulate()) {
grains = g.grains;
}
return grains;
}
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