···11+\--- Day 2: Cube Conundrum ---
22+----------
33+44+You're launched high into the atmosphere! The apex of your trajectory just barely reaches the surface of a large island floating in the sky. You gently land in a fluffy pile of leaves. It's quite cold, but you don't see much snow. An Elf runs over to greet you.
55+66+The Elf explains that you've arrived at *Snow Island* and apologizes for the lack of snow. He'll be happy to explain the situation, but it's a bit of a walk, so you have some time. They don't get many visitors up here; would you like to play a game in the meantime?
77+88+As you walk, the Elf shows you a small bag and some cubes which are either red, green, or blue. Each time you play this game, he will hide a secret number of cubes of each color in the bag, and your goal is to figure out information about the number of cubes.
99+1010+To get information, once a bag has been loaded with cubes, the Elf will reach into the bag, grab a handful of random cubes, show them to you, and then put them back in the bag. He'll do this a few times per game.
1111+1212+You play several games and record the information from each game (your puzzle input). Each game is listed with its ID number (like the `11` in `Game 11: ...`) followed by a semicolon-separated list of subsets of cubes that were revealed from the bag (like `3 red, 5 green, 4 blue`).
1313+1414+For example, the record of a few games might look like this:
1515+1616+```
1717+Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
1818+Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
1919+Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
2020+Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
2121+Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green
2222+2323+```
2424+2525+In game 1, three sets of cubes are revealed from the bag (and then put back again). The first set is 3 blue cubes and 4 red cubes; the second set is 1 red cube, 2 green cubes, and 6 blue cubes; the third set is only 2 green cubes.
2626+2727+The Elf would first like to know which games would have been possible if the bag contained *only 12 red cubes, 13 green cubes, and 14 blue cubes*?
2828+2929+In the example above, games 1, 2, and 5 would have been *possible* if the bag had been loaded with that configuration. However, game 3 would have been *impossible* because at one point the Elf showed you 20 red cubes at once; similarly, game 4 would also have been *impossible* because the Elf showed you 15 blue cubes at once. If you add up the IDs of the games that would have been possible, you get `*8*`.
3030+3131+Determine which games would have been possible if the bag had been loaded with only 12 red cubes, 13 green cubes, and 14 blue cubes. *What is the sum of the IDs of those games?*
3232+3333+To begin, [get your puzzle input](2/input).
3434+3535+Answer:
3636+3737+You can also [Shareon [Twitter](https://twitter.com/intent/tweet?text=%22Cube+Conundrum%22+%2D+Day+2+%2D+Advent+of+Code+2023&url=https%3A%2F%2Fadventofcode%2Ecom%2F2023%2Fday%2F2&related=ericwastl&hashtags=AdventOfCode) [Mastodon](javascript:void(0);)] this puzzle.
+13
2023/day02/test.ts
···11+import { assertEquals } from "https://deno.land/std@0.208.0/assert/mod.ts";
22+import * as p1 from "./part1.ts";
33+import * as p2 from "./part2.ts";
44+55+Deno.test("part1", () => {
66+ const examples = ["abc", "def"].join("\n");
77+ assertEquals(p1.answer(examples), 42);
88+});
99+1010+Deno.test("part2", () => {
1111+ const examples = ["abc", "def"].join("\n");
1212+ assertEquals(p2.answer(examples), 42);
1313+});