summaryrefslogtreecommitdiff
path: root/2023/02/src/part1.cpp
diff options
context:
space:
mode:
authorFederico Igne <undyamon@disroot.org>2023-12-03 18:57:02 +0100
committerFederico Igne <undyamon@disroot.org>2023-12-03 18:57:02 +0100
commitbaaa6cd61c302c80c664e9aaa5e4ab2ab157b5cf (patch)
tree7d4d90f06b3f005f1dace2acf9ce154b22ed0e37 /2023/02/src/part1.cpp
parent109f2eff37a72d844ad785f7bd2b9dc7d01353b6 (diff)
downloadaoc-baaa6cd61c302c80c664e9aaa5e4ab2ab157b5cf.tar.gz
aoc-baaa6cd61c302c80c664e9aaa5e4ab2ab157b5cf.zip
aoc(2302): Cube Conundrum
Diffstat (limited to '2023/02/src/part1.cpp')
-rw-r--r--2023/02/src/part1.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/2023/02/src/part1.cpp b/2023/02/src/part1.cpp
new file mode 100644
index 0000000..c9fe48c
--- /dev/null
+++ b/2023/02/src/part1.cpp
@@ -0,0 +1,33 @@
1#include <iostream>
2#include <fstream>
3
4#include "game.h"
5
6int main(void)
7{
8 int answer{};
9 std::vector<Game> games{};
10
11 std::ifstream input{ "resources/input.txt" };
12 if (input.is_open())
13 {
14 std::string line;
15
16 while (not std::getline(input,line).eof())
17 {
18 games.push_back(Game::from_string(line));
19 }
20 }
21 input.close();
22
23 for (const auto& game : games)
24 {
25 if (game.is_valid(14, 12, 13))
26 {
27 answer += game.id();
28 }
29 }
30
31 std::cout << answer << std::endl;
32 return 0;
33}