AoC 2022 Day 5: Stackinator

Source: Supply Stacks

Part 1

Given a list of stacks of syntax 1 and instructions in the form syntax 2, apply each instruction to pop qty items from the stack src and put them on dst one at a time.

Syntax 1: Stacks

    [D]    
[N] [C]    
[Z] [M] [P]
 1   2   3 

Syntax 2: Instructions

move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2

read more...


Advent of Code 2022

Let’s do this thing!

I’m going to try Rust this time, since it’s 1) awesome 2) fast and 3) crazy. :D

Let’s see how it goes!

If you’d like to see the full form of any particular solution, you can do so on GitHub (including previous years and possibly some I haven’t written up yet): jpverkamp/advent-of-code

read more...


Stateful Solvers and Iterators

Rust, yet again! Let’s take what we did last time with Solving Sudoku (again) and improve the code structure a bit more.

Goals:

  • Create a ‘Solver’ struct that can maintain state (such as how many states we’ve visited, how much time we’ve spent)
  • Track the above stats
  • Turn the ‘Solver’ into an iterator which will iterate through given solutions (a single call will give the first solution or you can run through the iterator to get all of them)

If you’d like to follow along, I’ve started uploading the code here: https://github.com/jpverkamp/rust-solvers

read more...