Articles tagged #wasm
Day 12 (Advent of Code 2022)
Alright! The day 12 puzzle involves path finding, and it seems like a good time to lean more heavily on the WASM embeds I've set up for the previous parts.
Let's start by setting up the types we'll want!
Types and parsing
Our input is a heightmap, like so:
Sabqponm
abcryxxl
accszExk
acctuvwj
abdefghi
Where 'a'..='z'
is a square with a given elevation (from lowest to highest),
is the start, and is the end.
Day 10 (Advent of Code 2022)
Onwards! To the day 10 puzzle.
I don't see a way to make part 1 especially fun — so let's just get to it.
Parsing
As usual, let's reach for the nom crate...
$ cargo add nom@7
(cut)
...to parse the input into nicely-organized Rust data structures:
// in `src/main.rs`
use nom::{
branch::alt,
bytes::complete::tag,
combinatormap value
sequencepreceded
IResult
Noop
Addx
->
noop =
addx = nomcharactercompletei32
Noop noop addx Addxi
->
Noop =>
Addx_ =>
Day 9 (Advent of Code 2022)
The Advent of Code is not a sprint: it's a marathon: sometimes you've got to stop and smell the roses.
I... what? That's not.. have you done a marathon before?
No, and I haven't taken any creative writing classes either, I think you can tell. Anyway: Day 8 was a bit aggravating for me. In 2020 I gave up AoC after Day 14 I think, and then I skipped a year. It doesn't help that it overlaps some holidays and stuff, but!
Go back to the homepage.