AoC 2023, Day 2, Cube Conundrum
Today’s puzzle is Cube Conundrum.
Part 1
I will start by defining a few types, cube, game.
I need a way to see if a given game is valid (a game is valid if all sets in the game are valid).
I need to be able to read the input text
I will now create a bag (which is just a set).
And then read the example text, convert it to a list of games, validate each one, and then get a sum of the numbers.
The result is correct for the example, and my answer for the puzzle is correct as well.
Part 2
In Part 2 I need to find the minimum bag needed for each game. This can be done by fining the maximum of each cube colour in each game.
I need a small function to calculate the power of each games minimum bag.
Now I put this all together and see if my results are close.
`2286` is the result I am expecting with the example input. My final answer is also correct, I have one more gold star.