AoC 2022 Day 11: Monkeyinator

Source: Monkey in the Middle

Part 1

Simulate a collection of ‘monkeys’. Each monkey will have a number of items which it will then apply a mathematical operation to, then always divide by 3, then test divisibility to pass to one of two other monkeys. Return as answer the product of the two highest number of times a monkey applies it’s main function to individual items after 20 steps.

Note: Monkeys will always be evaluated in order (so monkey 1 will evaluate any items passed by monkey 0 again in the same round).

read more...


AoC 2022 Day 10: Interpretator

Source: Cathode-Ray Tube

Part 1

Implement a simple virtual machine with two instructions: nop which does nothing for 1 cycles and addx $n which adds $n to the X register (initial value 1) in two cycles. Calculate the sum of cycle * X for the cycles 20, 60, 100, 140, 180, 220.

read more...


AoC 2022 Day 9: Ropeinator

Source: Rope Bridge

Part 1

Simulate two connected links such that whenever the first link (head) moves, the tail moves to follow according to the following rules:

  • If the tail is at the same location as head, don’t move
  • If the tail is adjacent to the head (orthogonal or diagonal), don’t move
  • If the tail is in the same row/column as the head, move one directly towards it orthogonally
  • If the tail is in neither the same row nor column, move one towards diagonally

Count how many unique spaces are visited by the tail of the link.

read more...


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...