Advent of Code 2022 Day 2 Solution: Rock, Paper, Scissors

What does day 2 of Advent of Code have in store for us?

Ashley Peacock

--

Photo by Marcus Wallis on Unsplash

Spoilers ahead for day 2 of Advent of Code! If you don’t want to be given the answers, look away now!

It’s day 2 of Advent of Code, if you missed out on day 1, you can check out my solution for that day here.

For anyone not familiar, my day 1 article also details what Advent of Code is. In short, it’s essentially a coding-related advent calendar that’s run each December. Each day there’s challenges to complete, usually increasing in difficulty as the days go on.

Let’s take a look at day 2’s challenge!

The Problem: Rock, Paper, Scissors

I’m sure we all know the game rock, paper, scissors. If you don’t, have a quick Google, as this won’t make much sense without knowing the simple rules to the game!

I won’t spoil the carefully crafted story, if you want to read that for yourself, head over to the Advent of Code site. For day 2's first problem, we’re given a long input, with each line containing two letters separated by a space.

The first letter represents what the opponent chooses to play, and the second letter represents what you, the player, chooses. There’s…

--

--