Public
Edited
Dec 8, 2022
Insert cell
Insert cell
Insert cell
Insert cell
raw = await FileAttachment("input-2022-day02").text()
Insert cell
data = raw.split("\n").map(d => {
let split = d.split(" ")
return ({opp: split[0], you: split[1]})
})
Insert cell
// interesting question: how to alter string by ascii?
Insert cell
Insert cell
aq.from(data)
.derive({test: d => {
return d.opp.charCodeAt(0)
}})
.view()
Insert cell
Insert cell
T.tidy(
data,
T.mutate({
opp: d => String.fromCharCode(d.opp.charCodeAt(0) + 23)
})
)
Insert cell
/*
Rules:
A/X is rock
B/Y is paper
C/Z is scissors
*/
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