Platform
Resources
Pricing
Sign in
Get started
Visnu Pitiyanuvath
Workspace
Fork
Published
Advent of Code 2020
By
Visnu Pitiyanuvath
Edited
Dec 12, 2020
1 fork
1 star
Advent of Code 2020
Day 1: Report Repair
Day 2: Password Philosophy
Day 3: Toboggan Trajectory
Day 4: Passport Processing
Day 5: Binary Boarding
Day 6: Custom Customs
Day 7: Handy Haversacks
Day 8: Handheld Halting
Day 9: Encoding Error
Day 10: Adapter Array
Day 11: Seating System
Day 12: Rain Risk
Day 13: Shuttle Search
Day 14: Docking Data
Day 15: Rambunctious Recitation
Day 16: Ticket Translation
Day 17: Conway Cubes
Day 18: Operation Order
Day 19: Monster Messages
Day 25: Combo Breaker
Advent of Code Leaderboard 2020
Insert cell
Insert cell
{
return
emoji
(
)
.
map
(
l
=>
l
.
join
(
''
)
)
.
join
(
'\n'
)
}
Insert cell
emoji
=
(
)
=>
map
.
map
(
l
=>
l
.
map
(
c
=>
c
===
'#'
?
'🌲'
:
' '
)
)
Insert cell
map
=
input
.
trim
(
)
.
split
(
'\n'
)
.
map
(
l
=>
l
.
split
(
''
)
)
Insert cell
step
=
(
[
y
,
x
]
,
[
dy
,
dx
]
)
=>
{
x
+=
dx
y
+=
dy
return
{
next
:
[
y
,
x
]
,
tree
:
check
(
[
y
,
x
]
)
===
'#'
?
1
:
0
}
}
Insert cell
check
=
(
[
y
,
x
]
)
=>
{
const
row
=
map
[
y
]
return
row
?
row
[
x
%
row
.
length
]
:
''
}
Insert cell
function
*
run
(
delta
)
{
let
current
=
[
0
,
0
]
while
(
current
[
0
]
<
map
.
length
)
{
const
{
next
,
tree
}
=
step
(
current
,
delta
)
yield
{
next
,
tree
}
current
=
next
}
}
Insert cell
total
=
(
delta
)
=>
{
let
total
=
0
for
(
const
{
tree
}
of
run
(
delta
)
)
total
+=
tree
return
total
}
Insert cell
part1
=
total
(
[
1
,
3
]
)
Insert cell
part2
=
[
[
1
,
1
]
,
[
1
,
3
]
,
[
1
,
5
]
,
[
1
,
7
]
,
[
2
,
1
]
]
.
map
(
total
)
.
reduce
(
(
product
,
i
)
=>
product
*
i
)
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
emoji
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
map
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
step
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
check
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
run
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
total
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
part1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
part2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
input
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
example
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML