advent2024

Advent of Code 2024
git clone git://bsandro.tech/advent2024
Log | Files | Refs

commit 92ab835688bf0b22bf7707d1890e82db304e8282
parent 7135454e80ee5026743a72fc7b957855b1c6c62f
Author: bsandro <email@bsandro.tech>
Date:   Sat, 14 Dec 2024 22:12:17 +0200

Day 14 parsing

Diffstat:
Mday14/main.cpp | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/day14/main.cpp b/day14/main.cpp @@ -39,7 +39,8 @@ T read_file(const std::string &path) { return buf; } -int64_t part1(Data input [[ maybe_unused ]]) { +int64_t part1(Data input, Vec2 mapSize) { + std::printf("map size: %dx%d\n", mapSize.x, mapSize.y); for (auto &r:input) { std::printf("Robot pos: %d,%d; velocity: %d,%d\n", r.p.x, r.p.y, r.v.x, r.v.y); } @@ -54,7 +55,8 @@ int main(int argc, char **argv) { const std::string fname = argc>1 ? argv[1] : "test1.txt"; std::cout << "AoC 2024 day 14 " << fname << std::endl; Data input = read_file<Data, Robot>(fname); - std::cout << "part1: " << part1(input) << std::endl; + Vec2 mapSize = fname.contains("test") ? Vec2(11,7) : Vec2(101,103); + std::cout << "part1: " << part1(input, mapSize) << std::endl; std::cout << "part2: " << part2(input) << std::endl; return 0;