AOC 2022 — Day 2

Matt E.
5 min readJan 12, 2023

Today I’ll detail my solution for the second challenge of the Advent of Code 2022. If you don’t know what that is, I’ll send you towards the presentation in Day 1

https://adventofcode.com/2022/day/2

The Elves begin to set up camp on the beach. They organise a giant tournament of Rock Paper Scissors to decide who will be closest to the food.

In case you need a reminder of the rules, you can find them here.

To win the tournament, you need to end up with the highest score. Here how the score are computed for each round :

So if you win with Rock, you get 7 points. If you lose with Scissors you get 3 points and so on.

Part 1

An elf gives you a strategy guide. The first columns represent your opponent’s move, but before he finishes his explanation, you’re interrupted and he has to go.

You suppose the second column is the move you need to choose.

The goal for this challenge is to compute the score you will have at the end of the tournament if you follow the strategy guide.

Input

--

--

Matt E.

Software engineer at Achiev & Jounco. Passionate about programming and entrepreneurship