Published a YouTube video
Used Rust
Hosted a live stream on Twitch
+1
Published a new episode of Solving Advent of Code in Rust: https://youtu.be/37whDIq4Q5c

Advent of code in Rust - solving year 2020 exercise 23 part 2 (Twitch Live 2021-12-06)


In this episode, we completed Advent of Code y2020 ex23!

In this exercise we are simulating a new game. This time it's about swapping elements in a circular linked list by following a certain number of rules. We need to run a certain number of rounds and make sure that the final configuration is correct.

In this episode we ended up implementing a circular list to support part 2 of the exercise. Our circular list is not a generic one and assumes the list is dense and that there are no repeated values.

With this approach we were able to simulate 10 million iterations of the game in a relatively short amount of time.

We got a little bit bogged down on how to implement windowed iterators and had a bit of a fight with the FromIterator trait (https://doc.rust-lang.org/stable/std/iter/trait.FromIterator.html) and the borrow checker. In the end, we figured out a solution using itertools (https://docs.rs/itertools/latest/itertools/) but it's probably not optimal.

We might revisit it and clean up a little, so make sure to check out the official repository!

If you have any suggestion, we'd love to hear it, so please leave a comment or a create a PR!

For all the source code check out the official GitHub repo: https://github.com/lmammino/rust-advent

For seeing the next episodes live check out our Twitch channel: https://twitch.tv/loige