day 1 and 2

This commit is contained in:
kirreen 2023-12-03 17:03:15 +01:00
commit 639ef038b2
14 changed files with 1460 additions and 0 deletions

4
' Normal file
View file

@ -0,0 +1,4 @@
day1a
day1b
day2a
day2b

1
README.md Normal file
View file

@ -0,0 +1 @@
messy solutions for simple problems

50
day1/day1.c Normal file
View file

@ -0,0 +1,50 @@
#include <stdio.h>
int main()
{
FILE *input;
input = fopen("./input", "r");
FILE *output;
output = fopen("./output", "w");
char inChar;
char numbers[4];
numbers[2] = '\n';
numbers[3] = '\0';
int numIndex = 0;
while((inChar = fgetc(input)) != EOF) {
if (inChar >= '0' && inChar <= '9' && numIndex == 0) {
numbers[0] = inChar;
numbers[1] = inChar;
numIndex = 1;
} else if (inChar >= '0' && inChar <= '9' && numIndex == 1) {
numbers[1] = inChar;
} else if (inChar == EOF || inChar == '\n' || inChar == '\0') {
fputs(numbers, output);
numIndex = 0;
numbers[0] = '0';
numbers[1] = '0';
}
}
fclose(input);
fclose(output);
int sum = 0;
input = fopen("./output", "r");
while((inChar = fgetc(input)) != EOF) {
if (inChar >= '0' && inChar <= '9' && numIndex == 0) {
sum += (inChar - '0') * 10;
numIndex = 1;
} else if (inChar >= '0' && inChar <= '9' && numIndex == 1) {
sum += inChar - '0';
numIndex = 0;
} else if (inChar == EOF)
break;
}
printf("%d\n", sum);
fclose(input);
}

BIN
day1/day1a Executable file

Binary file not shown.

34
day1/day1a.c Normal file
View file

@ -0,0 +1,34 @@
#include <stdio.h>
int main()
{
FILE *input;
input = fopen("./input", "r");
char inChar;
char numbers[4];
numbers[2] = '\n';
numbers[3] = '\0';
int numIndex = 0;
int sum = 0;
while((inChar = fgetc(input)) != EOF) {
if (inChar >= '0' && inChar <= '9' && numIndex == 0) {
numbers[0] = inChar;
numbers[1] = inChar;
numIndex = 1;
} else if (inChar >= '0' && inChar <= '9' && numIndex == 1) {
numbers[1] = inChar;
} else if (inChar == EOF || inChar == '\n' || inChar == '\0') {
//fputs(numbers, output);
sum += (numbers[0] - '0') * 10 + (numbers[1] - '0');
numIndex = 0;
numbers[0] = '0';
numbers[1] = '0';
}
}
fclose(input);
printf("%d\n", sum);
}

BIN
day1/day1b Executable file

Binary file not shown.

80
day1/day1b.c Normal file
View file

@ -0,0 +1,80 @@
#include <stdio.h>
#include <string.h>
#include <limits.h>
char *firstMatch (char *string, int offset, int *digit);
char *lastMatch (char *string, int *digit);
// array of strings with all digits and human-numbers
const char *numbers[] = {"one", "two", "three", "four", "five", "six",
"seven", "eight", "nine",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
int main()
{
FILE *input;
input = fopen("./input", "r");
int digit = 0;
int value = 0;
int sum = 0;
char row[100];
// use fgets
while ((fgets(row, 100, input)) != 0) {
firstMatch(row, 0, &digit);
value = digit * 10;
lastMatch(row, &digit);
value += digit;
printf("value: %d\n", value);
sum += value;
}
fclose(input);
printf("%u\n", sum);
}
// function with input offset and string, returns offset (and val?)
// looks for every string / char, return lowest offset
// to find rightmost, repeatedly call this function with offset + 1
char *firstMatch (char *string, int offset, int *digit)
{
// this ptr is 1 step outside of the array, because the
// relational operators in C are only defined if both pointers
// point within the same array or one step beyond the last member
char *first = &string[99] + 1;
// looks for each number string from numbers[]
// and remembers the lowest pointer
char *match;
for (int i = 0; i < sizeof(numbers) / 8; i++) {
match = strstr(string + offset, numbers[i]);
if (match == 0) continue;
if (match < first) {
first = match;
if (i <= 8) {
*digit = i + 1;
} else {
*digit = i - 9;
}
}
}
// Pointer unchanged? No match, return NULL
if (first == &string[99] + 1) first = NULL;
return first;
}
char *lastMatch (char *string, int *digit)
{
char *last = &string[0];
int offset = 0;
while (firstMatch(string, offset, digit) >= last) {
if (firstMatch(string, offset, digit) == NULL) break;
last = firstMatch(string, offset, digit);
offset++;
}
return last;
}

1000
day1/input Normal file

File diff suppressed because it is too large Load diff

BIN
day2/day2a Executable file

Binary file not shown.

82
day2/day2a.c Normal file
View file

@ -0,0 +1,82 @@
#include <stdio.h>
#include <string.h>
#include <limits.h>
// cubes, R, G, B
const int cubes[3] = {12, 13, 14};
const char *colors[] = {"red", "green", "blue"};
int getCubes(char *ptr);
int main ()
{
int gameID = 0;
int gameSum = 0;
char row[160];
char *ptr;
int length = 0;
int gameCubes[3] = {0, 0, 0};
int gameHands = 0;
int offset = 0;
FILE *input;
input = fopen("./input", "r");
nextGame:
// for each row
while(fgets(row, 160, input) != NULL) {
// increment game count
gameID++;
gameHands = 1;
offset = 0;
for (int i = 0; i < 3; i++) gameCubes[i] = 0;
// change each ; to \0
while(ptr = strchr(ptr, ';')) {
ptr[0] = '\0';
gameHands++;
ptr++;
}
// for each 'hand' (semicolon) ((NULL-char))
for(gameHands; gameHands > 0; gameHands--) {
// for each color
for(int i = 0; i < 3; i++) {
// use strstr to find color,
// move pointer to the beginning of said colour
ptr = strstr(row + offset, colors[i]);
// if (strstr(row, colors[i]) != NULL)
if (ptr != NULL)
gameCubes[i] = getCubes(ptr);
// higher than colors[i]? jump to next game
if (gameCubes[i] > cubes[i]) {
goto nextGame;
}
}
// pointer = strstr \0 + 1
offset += strlen(&row[offset]) + 1;
ptr = row + offset;
}
// hit \n? add game ID to sum
printf("Game %d valid\n", gameID);
gameSum += gameID;
}
printf("Game ID sum: %d\n", gameSum);
}
int getCubes(char *ptr)
{
int num = 0;
// get two chars: pointer -3, pointer -2
// convert them to an int
if (ptr[-3] >= '0' && ptr[-3] <= '9') {
num += (ptr[-3] - '0') * 10;
}
if (ptr[-2] >= '0' && ptr[-2] <= '9') {
num += ptr[-2] - '0';
}
return num;
}

BIN
day2/day2b Executable file

Binary file not shown.

104
day2/day2b.c Normal file
View file

@ -0,0 +1,104 @@
#include <stdio.h>
#include <string.h>
#include <limits.h>
#define MAX_GAMES 101
// cubes, R, G, B
const int cubes[3] = {12, 13, 14};
const char *colors[] = {"red", "green", "blue"};
int getCubes(char *ptr);
int main ()
{
int gameID = 0;
int gameSum = 0;
char row[160];
char *ptr;
int length = 0;
int gameCubes[3] = {0, 0, 0};
int gameHands = 0;
int offset = 0;
int game[MAX_GAMES] = {0};
for (int i = 1; i < MAX_GAMES; i++)
game[i] = i;
int powerSum = 0;
FILE *input;
input = fopen("./input", "r");
// for each row
while(fgets(row, 160, input) != NULL) {
// increment game count
gameID++;
gameHands = 1;
offset = 0;
for (int i = 0; i < 3; i++) gameCubes[i] = 0;
printf("\nGame %d hands: %d\n", gameID, gameHands);
printf("%s\n", row);
// not neccesary to decide length when we know amount of ';'?
// length = strchr(row, '\n') - &row[0];
// change each ; to \0
while(ptr = strchr(ptr, ';')) {
ptr[0] = '\0';
gameHands++;
ptr++;
}
// for each 'hand' (semicolon) ((NULL-char))
for(gameHands; gameHands > 0; gameHands--) {
printf("%s\n", row + offset);
// for each color
for(int i = 0; i < 3; i++) {
// use strstr to find color,
// move pointer to the beginning of said colour
ptr = strstr(row + offset, colors[i]);
// if (strstr(row, colors[i]) != NULL)
if (ptr != NULL) {
if (gameCubes[i] < getCubes(ptr))
gameCubes[i] = getCubes(ptr);
}
// higher than colors[i]? invalidate the game
if (gameCubes[i] > cubes[i]) {
game[gameID] = 0;
// printf("Game %d invalid\n", gameID);
}
}
// pointer = strstr \0 + 1
offset += strlen(&row[offset]) + 1;
ptr = row + offset;
}
// printf("Game %d required RGB: %d, %d, %d\n",
// gameID, gameCubes[0],gameCubes[1],gameCubes[2]
// );
powerSum += gameCubes[0] * gameCubes[1] * gameCubes[2];
printf("Game %d powersum: %d\nCurrent Total: %d\n", gameID, gameCubes[0] * gameCubes[1] * gameCubes[2], powerSum);
}
for (int i = gameID + 1; i < MAX_GAMES; i++)
game[i] = 0;
for (int i = 0; i < MAX_GAMES; i++) {
gameSum += game[i];
}
printf("Game ID sum: %d\n", gameSum);
printf("Total power sum: %d\n", powerSum);
}
int getCubes(char *ptr)
{
int num = 0;
// get two chars: pointer -3, pointer -2
// convert them to an int
if (ptr[-3] >= '0' && ptr[-3] <= '9') {
num += (ptr[-3] - '0') * 10;
}
if (ptr[-2] >= '0' && ptr[-2] <= '9') {
num += ptr[-2] - '0';
}
return num;
}

100
day2/input Normal file
View file

@ -0,0 +1,100 @@
Game 1: 8 green, 4 red, 4 blue; 1 green, 6 red, 4 blue; 7 red, 4 green, 1 blue; 2 blue, 8 red, 8 green
Game 2: 11 green, 7 blue, 15 red; 13 red, 6 green, 2 blue; 7 green, 9 red, 10 blue; 5 blue, 1 red, 11 green; 4 blue, 18 green; 4 red, 8 blue, 18 green
Game 3: 7 red, 10 green, 4 blue; 2 blue, 3 green, 5 red; 9 red, 7 green, 3 blue; 3 blue, 6 green, 18 red
Game 4: 1 blue, 2 green, 5 red; 10 red, 1 blue, 3 green; 14 red
Game 5: 16 red, 4 green, 19 blue; 13 blue, 9 red; 7 green, 14 red, 2 blue; 5 green, 18 blue, 4 red; 7 red, 2 blue, 3 green; 8 blue, 12 green
Game 6: 3 blue, 8 green; 4 red, 5 green; 5 red, 8 blue, 5 green; 8 blue, 4 green; 3 red, 7 green, 2 blue
Game 7: 7 red, 2 blue; 5 red, 6 green; 10 red; 2 blue, 12 red, 2 green; 4 red, 1 blue, 1 green; 9 green, 2 blue, 10 red
Game 8: 3 red, 7 green, 3 blue; 2 green, 3 blue, 3 red; 3 blue, 4 green, 1 red; 3 blue, 3 red; 2 blue, 6 green; 2 red, 7 green, 1 blue
Game 9: 5 red, 6 green; 6 red; 2 blue, 3 green, 9 red; 6 green, 2 blue
Game 10: 5 red, 8 blue, 5 green; 15 red, 6 green, 7 blue; 8 blue, 6 red, 5 green; 5 green, 2 blue; 12 red, 6 blue; 6 green, 16 red, 6 blue
Game 11: 3 red, 7 blue; 2 red, 3 blue, 6 green; 4 red, 5 green, 2 blue
Game 12: 15 green, 6 red, 2 blue; 3 red, 8 green, 9 blue; 8 blue, 2 red, 7 green; 5 red, 11 green, 6 blue
Game 13: 1 blue; 1 green, 6 red; 8 red, 3 blue; 5 blue, 8 red, 2 green
Game 14: 4 green, 1 blue; 8 blue, 5 green, 1 red; 2 green, 8 blue, 3 red
Game 15: 7 blue, 9 red, 8 green; 9 green, 12 blue, 5 red; 8 green, 10 blue, 2 red
Game 16: 1 blue, 1 red, 14 green; 6 green, 4 blue, 1 red; 16 blue, 14 green; 6 green, 2 red, 9 blue; 1 red, 1 blue; 2 red, 13 green, 7 blue
Game 17: 1 red, 9 green; 9 red, 5 blue, 2 green; 2 red, 8 green, 5 blue; 5 blue, 1 green, 3 red; 3 green, 5 blue; 3 red, 5 blue, 9 green
Game 18: 3 blue, 5 red, 3 green; 8 blue, 14 green; 3 blue, 11 red; 2 blue, 10 red, 9 green
Game 19: 7 green, 8 blue, 10 red; 1 green, 10 red, 2 blue; 6 blue, 4 red, 11 green; 7 red, 4 green; 6 blue, 4 red; 4 green, 2 red, 3 blue
Game 20: 5 red; 16 blue, 4 green, 7 red; 1 red, 1 green, 4 blue; 3 blue, 4 green, 7 red; 5 blue, 2 red, 3 green; 17 blue, 5 red
Game 21: 11 red, 4 green, 4 blue; 11 red, 5 blue, 2 green; 11 red, 13 green, 2 blue; 13 green, 6 red, 5 blue; 7 green, 4 blue, 8 red; 6 red, 8 blue, 14 green
Game 22: 2 green, 1 red, 6 blue; 3 blue, 2 green; 7 green, 10 red; 10 red, 7 blue, 5 green
Game 23: 14 green, 8 blue; 2 red, 5 green; 8 red, 16 green, 10 blue; 1 green, 7 red, 8 blue; 15 green, 5 red; 15 green, 2 red, 5 blue
Game 24: 4 blue, 1 green, 1 red; 1 blue, 8 green, 3 red; 4 red, 9 blue, 4 green
Game 25: 2 blue, 1 green, 3 red; 2 green, 4 red; 2 green, 1 blue
Game 26: 3 red, 5 green, 4 blue; 5 green, 8 blue; 1 blue, 3 green, 3 red; 7 blue, 2 red
Game 27: 13 red, 9 green, 6 blue; 19 blue, 9 red, 4 green; 14 red, 4 green, 11 blue; 5 green, 12 blue, 7 red
Game 28: 9 green, 4 blue, 15 red; 18 blue, 14 red, 12 green; 14 red, 12 blue, 3 green; 6 blue, 7 green, 15 red; 17 blue, 6 green, 9 red; 7 red, 12 green
Game 29: 17 red, 2 blue, 9 green; 5 blue, 15 red, 11 green; 13 red, 3 green, 5 blue; 4 green, 11 red, 1 blue; 5 green, 1 blue
Game 30: 3 green, 12 blue; 15 red, 2 blue, 6 green; 12 red, 11 blue, 10 green; 9 blue, 7 green, 14 red; 1 green, 7 red, 5 blue
Game 31: 6 green, 7 red, 18 blue; 2 green, 3 blue, 10 red; 9 blue, 8 red; 18 blue, 10 green, 4 red; 14 blue, 11 red, 10 green
Game 32: 7 green, 1 red, 5 blue; 5 green, 3 blue; 6 blue, 5 green; 5 red, 11 green, 6 blue
Game 33: 9 blue, 5 red; 2 blue; 6 red, 8 blue; 10 blue, 4 green, 6 red; 2 red, 4 green; 1 red, 6 blue, 2 green
Game 34: 1 red, 6 green; 3 green, 6 red, 2 blue; 2 red, 2 blue, 1 green; 5 green, 1 red, 2 blue
Game 35: 7 red, 2 green, 4 blue; 4 red, 2 green, 3 blue; 14 green, 2 blue, 5 red; 14 green, 2 red, 3 blue; 5 green, 2 red, 1 blue; 2 green, 8 red, 3 blue
Game 36: 7 green, 1 red, 1 blue; 3 blue, 6 green, 9 red; 2 blue, 17 red; 18 red, 2 green
Game 37: 6 red, 14 blue; 3 green, 2 blue; 18 blue, 6 red; 3 red, 18 blue, 3 green
Game 38: 6 blue, 8 red; 9 blue, 1 green, 1 red; 2 green, 10 blue, 1 red
Game 39: 9 red, 2 green; 7 red, 2 blue, 2 green; 2 blue, 1 red, 8 green
Game 40: 15 green, 1 blue, 1 red; 3 blue, 1 red, 6 green; 2 blue, 11 green; 2 blue, 11 green; 3 green, 4 blue, 1 red; 2 blue, 6 green
Game 41: 4 blue, 9 green; 11 green, 1 blue, 7 red; 1 red, 3 blue, 17 green; 17 green, 2 red; 2 blue, 16 green, 8 red; 1 blue, 8 green, 3 red
Game 42: 7 green, 15 blue, 2 red; 1 green, 5 blue, 5 red; 4 green, 6 red; 4 red, 4 blue, 1 green; 1 blue, 4 red
Game 43: 10 green, 6 blue, 8 red; 9 green, 9 red, 4 blue; 6 blue, 3 green, 6 red; 8 blue, 16 green, 7 red
Game 44: 14 red, 14 blue; 11 red, 1 blue; 1 green, 9 red, 15 blue; 1 green, 10 red
Game 45: 10 blue, 5 red; 1 green, 2 red, 11 blue; 2 blue, 10 red, 1 green
Game 46: 10 red, 9 green, 5 blue; 9 green, 2 red, 5 blue; 3 blue, 14 red, 4 green; 2 red, 1 green, 6 blue; 2 red, 9 blue, 4 green; 5 green, 2 blue, 11 red
Game 47: 9 red, 5 green, 1 blue; 3 red, 1 green; 8 red, 2 blue, 10 green; 9 green, 9 red, 2 blue; 13 green, 3 blue, 6 red
Game 48: 15 blue, 3 red, 8 green; 2 blue; 12 green, 7 blue, 1 red
Game 49: 9 blue, 3 red, 2 green; 12 green, 17 blue, 2 red; 3 green, 1 red, 8 blue; 16 blue, 3 green, 3 red
Game 50: 17 blue, 2 red, 14 green; 18 blue, 12 green; 13 blue, 6 red, 8 green; 4 blue, 6 red, 4 green
Game 51: 3 blue, 8 green, 4 red; 5 blue, 5 green, 4 red; 2 red, 8 blue, 2 green; 8 green, 3 blue; 9 green, 5 blue, 1 red
Game 52: 9 red, 5 green, 6 blue; 3 red, 8 green; 2 red, 3 blue, 6 green; 8 red, 4 blue, 2 green
Game 53: 6 green, 13 blue; 4 red, 7 green; 2 green, 7 red; 11 red, 2 blue; 12 blue, 9 green, 8 red
Game 54: 3 red, 3 blue, 3 green; 3 green, 2 red, 1 blue; 13 blue, 3 green; 5 red, 4 green, 13 blue; 4 green, 7 blue, 9 red
Game 55: 15 blue, 3 green, 2 red; 1 red, 8 green; 19 blue, 7 green; 4 green, 19 blue; 9 blue, 7 green, 2 red
Game 56: 1 blue, 9 green, 11 red; 3 blue, 12 green, 2 red; 1 blue, 12 green, 4 red; 16 green, 3 blue, 3 red; 18 red, 9 green
Game 57: 7 blue, 6 red, 3 green; 11 red, 5 blue, 4 green; 9 blue, 1 green, 5 red
Game 58: 17 green, 17 red, 6 blue; 10 red, 13 blue, 1 green; 7 red, 14 green; 6 red, 2 blue, 8 green; 13 red, 13 blue, 4 green
Game 59: 1 green, 4 red, 1 blue; 1 red, 1 green; 1 red; 4 blue; 6 red, 6 blue, 1 green
Game 60: 7 blue, 17 red, 8 green; 12 green, 6 red, 8 blue; 1 red, 9 blue, 12 green
Game 61: 2 green, 15 blue, 2 red; 1 green, 9 blue, 12 red; 12 red, 3 green, 19 blue
Game 62: 17 red, 1 blue; 5 green, 16 blue, 14 red; 3 red, 7 blue; 8 blue, 3 red, 1 green
Game 63: 9 red, 9 blue; 10 blue, 6 red, 9 green; 11 green, 1 blue, 13 red; 6 green, 13 blue, 9 red
Game 64: 16 blue, 2 red; 9 blue; 10 red, 1 blue, 4 green
Game 65: 1 blue, 18 green; 19 green, 1 red; 10 green, 1 blue, 1 red
Game 66: 12 blue, 5 green, 13 red; 3 green, 3 blue; 1 green, 1 blue, 11 red
Game 67: 5 red, 2 green; 7 red, 3 blue; 1 green, 8 red, 6 blue; 2 red, 5 blue; 8 red, 6 blue
Game 68: 8 green, 6 red, 18 blue; 8 green, 6 red, 3 blue; 4 red, 14 blue, 11 green
Game 69: 6 blue, 3 red, 1 green; 4 green, 6 red, 6 blue; 2 green, 13 red; 9 red, 5 blue, 6 green; 2 green, 11 red; 6 green, 2 red, 1 blue
Game 70: 7 blue, 18 green, 12 red; 17 green, 2 red, 8 blue; 17 red, 13 green, 2 blue; 1 red, 2 green, 7 blue
Game 71: 3 blue, 1 red, 15 green; 13 green, 2 red, 8 blue; 7 green, 12 blue; 7 blue, 12 green; 7 blue, 5 green
Game 72: 6 blue, 18 red; 1 blue, 4 green, 3 red; 11 red, 3 green; 6 blue, 5 red, 13 green; 11 green, 16 red, 5 blue; 3 green, 5 blue
Game 73: 18 red, 1 blue, 3 green; 4 blue, 4 red, 4 green; 1 blue, 3 red; 2 red, 1 green
Game 74: 5 red; 12 red, 4 green; 4 green, 5 red; 2 red, 1 blue, 4 green
Game 75: 2 red, 2 blue, 6 green; 2 blue, 6 green; 3 green, 1 red
Game 76: 6 green, 1 blue, 12 red; 2 green, 2 red, 3 blue; 3 green, 10 red, 3 blue; 3 blue, 16 red, 11 green; 15 red, 5 blue, 7 green; 4 green, 4 red, 3 blue
Game 77: 14 green, 4 blue, 11 red; 12 blue, 9 red, 19 green; 10 green, 4 blue
Game 78: 1 blue, 11 red; 1 blue, 14 green, 4 red; 7 green, 3 blue, 5 red
Game 79: 3 red, 13 blue; 14 blue, 5 red, 5 green; 1 green, 7 blue, 2 red; 5 green, 13 blue, 3 red; 7 blue, 5 red, 2 green
Game 80: 2 green, 11 blue; 2 red, 12 blue, 1 green; 11 blue, 11 green; 2 green, 12 blue, 1 red
Game 81: 8 blue, 5 green, 1 red; 1 red, 6 blue, 4 green; 6 green, 10 blue; 2 red, 9 blue, 2 green; 6 blue, 2 green; 6 green, 9 blue, 2 red
Game 82: 13 red, 12 green, 3 blue; 4 blue, 4 red, 1 green; 4 green, 8 red, 2 blue; 7 red, 13 green
Game 83: 2 green, 8 red, 1 blue; 2 blue, 6 red, 8 green; 5 green, 1 blue
Game 84: 6 red, 18 blue, 5 green; 3 green, 15 blue, 2 red; 6 red, 6 blue, 8 green; 1 red, 4 blue, 2 green; 2 blue, 5 green
Game 85: 3 red, 11 green, 2 blue; 3 blue, 6 green; 2 red, 4 green, 4 blue; 1 blue, 3 red, 10 green; 4 blue, 7 green, 4 red
Game 86: 7 green, 16 blue; 4 blue, 1 green, 7 red; 6 red, 15 green, 9 blue; 7 green, 9 red, 2 blue; 14 green, 2 blue
Game 87: 8 red, 3 blue, 8 green; 3 red, 1 blue, 8 green; 6 red, 5 green; 2 red, 6 green, 2 blue; 6 green, 2 red
Game 88: 1 blue, 4 red, 12 green; 4 red, 1 blue, 14 green; 1 blue, 10 green, 4 red; 1 blue, 10 red, 9 green
Game 89: 7 green, 6 red, 10 blue; 4 red, 5 green; 2 green, 13 blue, 2 red
Game 90: 16 blue, 2 green, 10 red; 4 green, 7 red, 14 blue; 4 blue, 11 green, 3 red; 3 red, 10 blue, 3 green
Game 91: 7 green, 7 red, 4 blue; 14 red, 11 blue; 16 red, 8 green, 15 blue
Game 92: 5 blue, 12 red, 3 green; 2 blue, 8 green, 5 red; 5 blue, 10 green; 11 green, 6 red, 4 blue; 5 red, 4 green, 4 blue
Game 93: 4 blue, 3 green, 5 red; 7 red, 17 blue; 8 blue, 7 green; 17 blue, 1 green; 2 red, 6 blue, 2 green; 15 blue, 3 red, 4 green
Game 94: 9 green, 3 red, 2 blue; 3 green, 6 red; 13 green, 4 red, 2 blue; 7 green; 4 green, 7 red; 2 red, 9 green, 2 blue
Game 95: 3 green, 11 red, 5 blue; 6 blue, 8 green; 9 green, 6 blue; 6 red, 1 green
Game 96: 3 blue, 3 green, 10 red; 2 blue, 12 red; 4 red, 3 blue; 2 green, 3 red, 1 blue; 2 green, 6 blue
Game 97: 5 blue, 3 green, 2 red; 2 blue, 3 green, 5 red; 12 red, 3 blue
Game 98: 2 blue, 2 red, 9 green; 4 green, 5 blue, 1 red; 15 green, 3 red, 9 blue
Game 99: 15 red, 7 green, 11 blue; 2 blue, 12 green, 17 red; 6 red, 3 blue, 11 green; 14 red, 13 green, 5 blue
Game 100: 5 green, 17 blue, 5 red; 15 blue; 13 green, 8 red, 3 blue; 16 blue, 15 green, 8 red; 16 green, 2 blue, 3 red

5
day2/input.bakeasy Normal file
View file

@ -0,0 +1,5 @@
Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green