Skip to content

Commit

Permalink
Day 13: speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeladler committed Dec 14, 2023
1 parent f9e965a commit 4e05040
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/day13/solve.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ void solve(const char *buf, size_t buf_size, Solution *result) {
int col = x + 1;
log_debug("found perfect vertical reflection between %d and %d", col, col + 1);
part1 += col;
break;
}
}
for (int y = 0; y < grid.rows - 1; y++) {
if (is_perfect_horizontal(&grid, y)) {
int row = y + 1;
log_debug("found perfect horizontal reflection between %d and %d", row, row + 1);
part1 += 100 * row;
break;
}
}
}
Expand Down

0 comments on commit 4e05040

Please sign in to comment.