File tree Expand file tree Collapse file tree 3 files changed +45
-3
lines changed
Expand file tree Collapse file tree 3 files changed +45
-3
lines changed Original file line number Diff line number Diff line change 1+
2+ #pragma once
3+
4+ #include < fstream>
5+ #include < string>
6+
7+ #include " spdlog/spdlog.h"
8+
9+ namespace AdventOfCode24 ::Day6 {
10+ typedef std::pair<int , int > coord;
11+ typedef std::pair<int , int > direction;
12+ typedef std::pair<coord,direction> status;
13+ std::pair<coord, std::vector<coord>> get_area_map (const std::filesystem::path& input_file);
14+ };
Original file line number Diff line number Diff line change @@ -195,12 +195,12 @@ namespace AdventOfCode24::Day4 {
195195 }
196196
197197 int count_matches_in_file (const std::filesystem::path& input_file, const std::string& word, bool wordsearch) {
198- std::deque<std::string> lines;
198+ std::deque<std::string> lines;
199199
200200 std::ifstream read_in (input_file, std::ios::in);
201201 std::string line;
202- int line_counter{0 };
203- int instance_counter{0 };
202+ int line_counter{0 };
203+ int instance_counter{0 };
204204
205205 while (std::getline (read_in, line)) {
206206 lines.push_back (line);
Original file line number Diff line number Diff line change 1+ #include " advent_of_code/day_6.hxx"
2+
3+ namespace AdventOfCode24 ::Day6 {
4+ std::pair<status, std::vector<coord>> get_area_map (const std::filesystem::path& input_file) {
5+
6+ std::ifstream read_in (input_file, std::ios::in);
7+ std::string line;
8+ std::vector<coord> area_map;
9+ status guard_init{{-1 ,-1 },{0 ,0 }};
10+ const char guard_symbols[4 ]{' v' ,' >' ,' <' ,' ^' };
11+
12+
13+ while (std::getline (read_in, line)) {
14+ char symbol{' @' };
15+ std::istringstream iss;
16+ iss.str (line);
17+ int column{0 }
18+
19+ while (iss >> symbol) {
20+ if (symbol == ' #' ) {
21+ area_map.push_back ({area_map.size (), column});
22+ column++;
23+ continue ;
24+ }
25+ auto find_guard = std::find (std::begin (guard_symbols), std::end (guard_symbols), symbol);
26+ }
27+ }
28+ };
You can’t perform that action at this time.
0 commit comments