AdventOfCode2021 - Day 2

This is a thread to discuss Day2
https://adventofcode.com/2021/day/2

REMEMBER!
It is VERY important NOT to write any public spoilers :slight_smile:
ALWAYS keep spoiler stuff hidden inside one of these

Summary

This text will be hidden

which you can obtain by clicking on the gear icon

image

This is my first successful run at part 1

duration = 35ms

Very simple method (as usual) :slight_smile:

This is my first successful run at part 2

duration = 30ms

For me - today's puzzle was quite an easy one
It didn't take much to alter Part 1 to complete Part 2

It'll still be interesting to see the HOF solutions for it though :slight_smile:

Another version for Part 2

Project

Here's my solutions

part 1

Part 2

and anyone who wants all my solutions, here's my project with them.
https://snap.berkeley.edu/versions/dev/snap.html#present:Username=ego-lay_atman-bay&ProjectName=advent%20of%20code%202021

Part2, slightly over-complicated as I expected actions vocabulary to be extended , 1000ms for 1000 route items

Aoc1-2 script pic (9)

Edit:

Part2, ~36ms with improved lookup for 1000 items

Aoc1-2 script pic (10)

Part 1

image

60ms

Part 2

11.7 seconds without warp block (very slow)
79ms with warp block !

project

with the small input...

.

in this version, we can visualize the submarine is flying because the submarine go up... hahaha, it's a subplane !

late for this lol but

Part 1

Part 2


uses look up list for actions to make it easy to pick the right one

oh cool u did similar to what i did!