commit 9076776a5169f88ef349e4c544ce1109b8111072
parent 47e5b0048bbf9df6db4e1d01b51bffbd59851ae7
Author: Louis Burda <quent.burda@gmail.com>
Date: Sun, 5 Dec 2021 23:24:07 +0100
[Day 4] Fix problem statement formatting
Diffstat:
M | src/04/part1 | | | 71 | +++++++++++++++++++++++++++++------------------------------------------ |
1 file changed, 29 insertions(+), 42 deletions(-)
diff --git a/src/04/part1 b/src/04/part1
@@ -1,19 +1,19 @@
--- Day 4: Giant Squid ---
You're already almost 1.5km (almost a mile) below the surface of the ocean, already so deep that you
-can't see any sunlight. What you [1m[37mcan[0m see, however, is a giant squid that has attached
-itself to the outside of your submarine.
+can't see any sunlight. What you [1m[37mcan[0m see, however, is a giant squid that has attached itself to the
+outside of your submarine.
Maybe it wants to play bingo?
Bingo is played on a set of boards each consisting of a 5x5 grid of numbers. Numbers are chosen at
-random, and the chosen number is [1m[37mmarked[0m on all boards on which it appears. (Numbers may
-not appear on all boards.) If all numbers in any row or any column of a board are marked, that board
+random, and the chosen number is [1m[37mmarked[0m on all boards on which it appears. (Numbers may not appear
+on all boards.) If all numbers in any row or any column of a board are marked, that board
[1m[37mwins[0m. (Diagonals don't count.)
-The submarine has a [1m[37mbingo subsystem[0m to help passengers (currently, you and the giant
-squid) pass the time. It automatically generates a random order in which to draw numbers and a
-random set of boards (your puzzle input). For example:
+The submarine has a [1m[37mbingo subsystem[0m to help passengers (currently, you and the giant squid) pass the
+time. It automatically generates a random order in which to draw numbers and a random set of boards
+(your puzzle input). For example:
7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
@@ -39,48 +39,35 @@ After the first five numbers are drawn (7, 4, 9, 5, and 11), there are no winner
are marked as follows (shown here adjacent to each other to save space):
22 13 17 [1m[37m11[0m 0 3 15 0 2 22 14 21 17 24 [1m[37m4[0m
- 8 2 23 [1m[37m4[0m 24 [1m[37m9[0m 18 13 17 [1m[37m5[0m 10 16 15
-[1m[37m9[0m 19
+ 8 2 23 [1m[37m4[0m 24 [1m[37m9[0m 18 13 17 [1m[37m5[0m 10 16 15 [1m[37m9[0m 19
21 [1m[37m9[0m 14 16 [1m[37m7[0m 19 8 [1m[37m7[0m 25 23 18 8 23 26 20
- 6 10 3 18 [1m[37m5[0m 20 [1m[37m11[0m 10 24 [1m[37m4[0m 22
-[1m[37m11[0m 13 6 [1m[37m5[0m
+ 6 10 3 18 [1m[37m5[0m 20 [1m[37m11[0m 10 24 [1m[37m4[0m 22 [1m[37m11[0m 13 6 [1m[37m5[0m
1 12 20 15 19 14 21 16 12 6 2 0 12 3 [1m[37m7[0m
After the next six numbers are drawn (17, 23, 2, 0, 14, and 21), there are still no winners:
-22 13 [1m[37m17[0m [1m[37m11[0m [1m[37m0[0m 3 15 [1m[37m0[0m [1m[37m2[0m
-22 [1m[37m14[0m [1m[37m21[0m [1m[37m17[0m 24 [1m[37m4[0m
- 8 [1m[37m2[0m [1m[37m23[0m [1m[37m4[0m 24 [1m[37m9[0m 18 13 [1m[37m17[0m
-[1m[37m5[0m 10 16 15 [1m[37m9[0m 19
-[1m[37m21[0m [1m[37m9[0m [1m[37m14[0m 16 [1m[37m7[0m 19 8 [1m[37m7[0m 25
-[1m[37m23[0m 18 8 [1m[37m23[0m 26 20
- 6 10 3 18 [1m[37m5[0m 20 [1m[37m11[0m 10 24 [1m[37m4[0m 22
-[1m[37m11[0m 13 6 [1m[37m5[0m
- 1 12 20 15 19 [1m[37m14[0m [1m[37m21[0m 16 12 6 [1m[37m2[0m
-[1m[37m0[0m 12 3 [1m[37m7[0m
+22 13 [1m[37m17[0m [1m[37m11[0m [1m[37m0[0m 3 15 [1m[37m0[0m [1m[37m2[0m 22 [1m[37m14[0m [1m[37m21[0m [1m[37m17[0m 24 [1m[37m4[0m
+ 8 [1m[37m2[0m [1m[37m23[0m [1m[37m4[0m 24 [1m[37m9[0m 18 13 [1m[37m17[0m [1m[37m5[0m 10 16 15 [1m[37m9[0m 19
+[1m[37m21[0m [1m[37m9[0m [1m[37m14[0m 16 [1m[37m7[0m 19 8 [1m[37m7[0m 25 [1m[37m23[0m 18 8 [1m[37m23[0m 26 20
+ 6 10 3 18 [1m[37m5[0m 20 [1m[37m11[0m 10 24 [1m[37m4[0m 22 [1m[37m11[0m 13 6 [1m[37m5[0m
+ 1 12 20 15 19 [1m[37m14[0m [1m[37m21[0m 16 12 6 [1m[37m2[0m [1m[37m0[0m 12 3 [1m[37m7[0m
Finally, 24 is drawn:
-22 13 [1m[37m17[0m [1m[37m11[0m [1m[37m0[0m 3 15 [1m[37m0[0m [1m[37m2[0m
-22 [1m[37m14[0m [1m[37m21[0m [1m[37m17[0m [1m[37m24[0m [1m[37m4[0m
- 8 [1m[37m2[0m [1m[37m23[0m [1m[37m4[0m [1m[37m24[0m [1m[37m9[0m 18 13
-[1m[37m17[0m [1m[37m5[0m 10 16 15 [1m[37m9[0m 19
-[1m[37m21[0m [1m[37m9[0m [1m[37m14[0m 16 [1m[37m7[0m 19 8 [1m[37m7[0m 25
-[1m[37m23[0m 18 8 [1m[37m23[0m 26 20
- 6 10 3 18 [1m[37m5[0m 20 [1m[37m11[0m 10 [1m[37m24[0m [1m[37m4[0m 22
-[1m[37m11[0m 13 6 [1m[37m5[0m
- 1 12 20 15 19 [1m[37m14[0m [1m[37m21[0m 16 12 6 [1m[37m2[0m
-[1m[37m0[0m 12 3 [1m[37m7[0m
-
-At this point, the third board [1m[37mwins[0m because it has at least one complete row or column
-of marked numbers (in this case, the entire top row is marked: [1m[37m14 21 17 24 4[0m).
-
-The [1m[37mscore[0m of the winning board can now be calculated. Start by finding the [1m[37msum
-of all unmarked numbers[0m on that board; in this case, the sum is 188. Then, multiply that sum by
-[1m[37mthe number that was just called[0m when the board won, 24, to get the final score, 188 *
-24 = [1m[37m4512[0m.
-
-To guarantee victory against the giant squid, figure out which board will win first. [1m[37mWhat
-will your final score be if you choose that board?[0m
+22 13 [1m[37m17[0m [1m[37m11[0m [1m[37m0[0m 3 15 [1m[37m0[0m [1m[37m2[0m 22 [1m[37m14[0m [1m[37m21[0m [1m[37m17[0m [1m[37m24[0m [1m[37m4[0m
+ 8 [1m[37m2[0m [1m[37m23[0m [1m[37m4[0m [1m[37m24[0m [1m[37m9[0m 18 13 [1m[37m17[0m [1m[37m5[0m 10 16 15 [1m[37m9[0m 19
+[1m[37m21[0m [1m[37m9[0m [1m[37m14[0m 16 [1m[37m7[0m 19 8 [1m[37m7[0m 25 [1m[37m23[0m 18 8 [1m[37m23[0m 26 20
+ 6 10 3 18 [1m[37m5[0m 20 [1m[37m11[0m 10 [1m[37m24[0m [1m[37m4[0m 22 [1m[37m11[0m 13 6 [1m[37m5[0m
+ 1 12 20 15 19 [1m[37m14[0m [1m[37m21[0m 16 12 6 [1m[37m2[0m [1m[37m0[0m 12 3 [1m[37m7[0m
+
+At this point, the third board [1m[37mwins[0m because it has at least one complete row or column of marked
+numbers (in this case, the entire top row is marked: [1m[37m14 21 17 24 4[0m).
+
+The [1m[37mscore[0m of the winning board can now be calculated. Start by finding the [1m[37msum of all unmarked
+numbers[0m on that board; in this case, the sum is 188. Then, multiply that sum by [1m[37mthe number that was
+just called[0m when the board won, 24, to get the final score, 188 * 24 = [1m[37m4512[0m.
+
+To guarantee victory against the giant squid, figure out which board will win first. [1m[37mWhat will your
+final score be if you choose that board?[0m