Skip to content

Commit c51d4e5

Browse files
author
bt
committed
day14: fix build
1 parent 0746dde commit c51d4e5

File tree

2 files changed

+2
-75
lines changed

2 files changed

+2
-75
lines changed

include/common_headers.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "utils/input_parser.hpp"
33

44
#include <algorithm>
5+
#include <array>
56
#include <cstdint>
67
#include <iostream>
78
#include <fstream>

src/day6.cpp

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "common_headers.hpp"
22
#include "Cursor.hpp"
33

4-
#include <vector>
4+
#include <tuple>
55
#include <set>
66
#include <unordered_set>
77

@@ -150,80 +150,6 @@ template<typename TGraph>
150150
std::cout << "\nmoves " << moves;
151151
return unique.size();
152152
}
153-
#if 0
154-
template<typename TGraph>
155-
[[nodiscard]] size_t solveSecondPart2(TGraph& graph)
156-
{
157-
std::vector<std::set<int>> colObst(graph.size());
158-
std::vector<std::set<int>> rowObst(graph[0].size());
159-
160-
for(int r = 0; r < graph.size(); ++r) {
161-
for(int c = 0; c < graph[0].size(); ++c) {
162-
if(graph[r][c] == '#') {
163-
colObst[c].emplace(r);
164-
rowObst[r].emplace(c);
165-
}
166-
}
167-
}
168-
169-
constexpr std::array<char, 4> figures{'|', '-', '|', '-'};
170-
auto [direction, row, col] = findInitialPosition(graph);
171-
graph[row][col] = '.';
172-
Cursor cursor{direction, row, col};
173-
size_t moves{};
174-
while(cursor.x() < graph.size() && cursor.y() < graph[0].size() && cursor.x() >= 0 && cursor.y() >= 0) {
175-
const auto curChar{graph[cursor.x()][cursor.y()]};
176-
177-
if(curChar == '#') {
178-
cursor.stepBack();
179-
cursor.turnRight();
180-
}
181-
else {
182-
183-
if(curChar != '.') {
184-
switch (cursor.direction())
185-
{
186-
case Cursor::Direction::Right:
187-
if(curChar & Dirs::Down) {
188-
++moves;
189-
unique.emplace(cursor.x(), cursor.y(), cursor.direction());
190-
std::cerr << "\nhit right: " << cursor.x() << " " << cursor.y();
191-
}
192-
break;
193-
case Cursor::Direction::Up:
194-
if(curChar & Dirs::Right) {
195-
++moves;
196-
unique.emplace(cursor.x(), cursor.y(), cursor.direction());
197-
198-
std::cerr << "\nhit up: " << cursor.x() << " " << cursor.y();
199-
}
200-
break;
201-
case Cursor::Direction::Down:
202-
if(curChar & Dirs::Left) {
203-
++moves;
204-
unique.emplace(cursor.x(), cursor.y(), cursor.direction());
205-
206-
std::cerr << "\nhit down: " << cursor.x() << " " << cursor.y();
207-
}
208-
break;
209-
case Cursor::Direction::Left:
210-
if(curChar & Dirs::Up) {
211-
++moves;
212-
unique.emplace(cursor.x(), cursor.y(), cursor.direction());
213-
214-
std::cerr << "\nhit left: " << cursor.x() << " " << cursor.y();
215-
}
216-
break;
217-
}
218-
}
219-
220-
cursor.move();
221-
}
222-
}
223-
std::cout << "\nmoves " << moves;
224-
return unique.size();
225-
}
226-
#endif
227153

228154
void printHelp()
229155
{

0 commit comments

Comments
 (0)