File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,10 @@ struct Board {
125
125
Vec2<int > dir = inst_dir (inst);
126
126
Vec2<int > next = robot + dir;
127
127
128
+ if (is_wall (next)) {
129
+ return ;
130
+ }
131
+
128
132
std::unordered_set<Vec2<int >> attached;
129
133
dfs_attached (next, inst, attached);
130
134
@@ -246,15 +250,9 @@ int main(int argc, char *argv[]) {
246
250
state = State::parse_from (file);
247
251
}
248
252
249
- std::cout << state.board1 ;
250
- std::cout << state.board2 ;
251
- for (Inst inst : state.insts ) {
252
- state.board2 .perform (inst);
253
- std::cout << " After " << inst << " : " << std::endl << state.board2 ;
254
- }
255
- // state.run();
256
- // std::cout << "Part 1: " << state.board1.sum_box_coords() << std::endl;
257
- // std::cout << "Part 2: " << state.board2.sum_box_coords() << std::endl;
253
+ state.run ();
254
+ std::cout << " Part 1: " << state.board1 .sum_box_coords () << std::endl;
255
+ std::cout << " Part 2: " << state.board2 .sum_box_coords () << std::endl;
258
256
259
257
return 0 ;
260
258
}
You can’t perform that action at this time.
0 commit comments