Compare commits
No commits in common. '8fa4e90613811fe3850a8c45cdf81b7a4c61de73' and 'dcee17005f61a1ecf78f8e8cc85f371deeca047d' have entirely different histories.
8fa4e90613
...
dcee17005f
52 changed files with 157 additions and 158 deletions
@ -1,46 +1,46 @@ |
|||||||
#include "Day02.h" |
#include "Day02.h" |
||||||
|
|
||||||
int Day02::getScore(char opponent, char me) { |
int Day02::getScore(char opponent, char me) { |
||||||
int outcome; |
int outcome; |
||||||
if (opponent == me) |
if (opponent == me) |
||||||
outcome = 3; |
outcome = 3; |
||||||
else if (opponent == me + 1 || opponent == me - 2) |
else if (opponent == me + 1 || opponent == me - 2) |
||||||
outcome = 0; |
outcome = 0; |
||||||
else |
else |
||||||
outcome = 6; |
outcome = 6; |
||||||
return outcome + me - 64; |
return outcome + me - 64; |
||||||
} |
} |
||||||
|
|
||||||
Result Day02::Task1() { |
Result Day02::Task1() { |
||||||
int score = 0; |
int score = 0; |
||||||
for (string line: input) { |
for (string line : input){ |
||||||
char predict = line.at(0); |
char predict = line.at(0); |
||||||
char answer = char(line.at(2) - 23); |
char answer = char(line.at(2) - 23); |
||||||
score += getScore(predict, answer); |
score += getScore(predict, answer); |
||||||
} |
} |
||||||
return to_string(score); |
return to_string(score); |
||||||
} |
} |
||||||
|
|
||||||
Result Day02::Task2() { |
Result Day02::Task2() { |
||||||
int score = 0; |
int score = 0; |
||||||
for (string line: input) { |
for (string line : input){ |
||||||
char predict = line.at(0); |
char predict = line.at(0); |
||||||
char outcome = line.at(2); |
char outcome = line.at(2); |
||||||
|
|
||||||
char answer; |
char answer; |
||||||
if (outcome == 'X') { |
if (outcome == 'X'){ |
||||||
if (predict > 'A') answer = char(predict - 1); |
if (predict > 'A') answer = char(predict - 1); |
||||||
else answer = 'C'; |
else answer = 'C'; |
||||||
} |
} |
||||||
if (outcome == 'Y') { |
if (outcome == 'Y'){ |
||||||
answer = predict; |
answer = predict; |
||||||
} |
} |
||||||
if (outcome == 'Z') { |
if (outcome == 'Z'){ |
||||||
if (predict < 'C') answer = char(predict + 1); |
if (predict < 'C') answer = char(predict + 1); |
||||||
else answer = 'A'; |
else answer = 'A'; |
||||||
} |
} |
||||||
|
|
||||||
score += getScore(predict, answer); |
score += getScore(predict, answer); |
||||||
} |
} |
||||||
return to_string(score); |
return to_string(score); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day03.h" |
#include "Day03.h" |
||||||
|
|
||||||
Result Day03::Task1() { |
Result Day03::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day03::Task2() { |
Result Day03::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day04.h" |
#include "Day04.h" |
||||||
|
|
||||||
Result Day04::Task1() { |
Result Day04::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day04::Task2() { |
Result Day04::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day05.h" |
#include "Day05.h" |
||||||
|
|
||||||
Result Day05::Task1() { |
Result Day05::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day05::Task2() { |
Result Day05::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day06.h" |
#include "Day06.h" |
||||||
|
|
||||||
Result Day06::Task1() { |
Result Day06::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day06::Task2() { |
Result Day06::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day07.h" |
#include "Day07.h" |
||||||
|
|
||||||
Result Day07::Task1() { |
Result Day07::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day07::Task2() { |
Result Day07::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day08.h" |
#include "Day08.h" |
||||||
|
|
||||||
Result Day08::Task1() { |
Result Day08::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day08::Task2() { |
Result Day08::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day09.h" |
#include "Day09.h" |
||||||
|
|
||||||
Result Day09::Task1() { |
Result Day09::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day09::Task2() { |
Result Day09::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day10.h" |
#include "Day10.h" |
||||||
|
|
||||||
Result Day10::Task1() { |
Result Day10::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day10::Task2() { |
Result Day10::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day11.h" |
#include "Day11.h" |
||||||
|
|
||||||
Result Day11::Task1() { |
Result Day11::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day11::Task2() { |
Result Day11::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day12.h" |
#include "Day12.h" |
||||||
|
|
||||||
Result Day12::Task1() { |
Result Day12::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day12::Task2() { |
Result Day12::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day13.h" |
#include "Day13.h" |
||||||
|
|
||||||
Result Day13::Task1() { |
Result Day13::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day13::Task2() { |
Result Day13::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day14.h" |
#include "Day14.h" |
||||||
|
|
||||||
Result Day14::Task1() { |
Result Day14::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day14::Task2() { |
Result Day14::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day15.h" |
#include "Day15.h" |
||||||
|
|
||||||
Result Day15::Task1() { |
Result Day15::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day15::Task2() { |
Result Day15::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day16.h" |
#include "Day16.h" |
||||||
|
|
||||||
Result Day16::Task1() { |
Result Day16::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day16::Task2() { |
Result Day16::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day17.h" |
#include "Day17.h" |
||||||
|
|
||||||
Result Day17::Task1() { |
Result Day17::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day17::Task2() { |
Result Day17::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day18.h" |
#include "Day18.h" |
||||||
|
|
||||||
Result Day18::Task1() { |
Result Day18::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day18::Task2() { |
Result Day18::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day19.h" |
#include "Day19.h" |
||||||
|
|
||||||
Result Day19::Task1() { |
Result Day19::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day19::Task2() { |
Result Day19::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day20.h" |
#include "Day20.h" |
||||||
|
|
||||||
Result Day20::Task1() { |
Result Day20::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day20::Task2() { |
Result Day20::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day21.h" |
#include "Day21.h" |
||||||
|
|
||||||
Result Day21::Task1() { |
Result Day21::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day21::Task2() { |
Result Day21::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day22.h" |
#include "Day22.h" |
||||||
|
|
||||||
Result Day22::Task1() { |
Result Day22::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day22::Task2() { |
Result Day22::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day23.h" |
#include "Day23.h" |
||||||
|
|
||||||
Result Day23::Task1() { |
Result Day23::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day23::Task2() { |
Result Day23::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day24.h" |
#include "Day24.h" |
||||||
|
|
||||||
Result Day24::Task1() { |
Result Day24::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day24::Task2() { |
Result Day24::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
@ -1,9 +1,9 @@ |
|||||||
#include "Day25.h" |
#include "Day25.h" |
||||||
|
|
||||||
Result Day25::Task1() { |
Result Day25::Task1() { |
||||||
return Day::Task1(); |
return Day::Task1(); |
||||||
} |
} |
||||||
|
|
||||||
Result Day25::Task2() { |
Result Day25::Task2() { |
||||||
return Day::Task2(); |
return Day::Task2(); |
||||||
} |
} |
Loading…
Reference in new issue