advent2023

Advent of Code 2023 solutions
git clone git://bsandro.tech/advent2023
Log | Files | Refs | LICENSE

commit 301ce41c9310a1d78504ba072640f22ce5812b3e
parent f18e52045ff61ae209f1752859199ceb4648743f
Author: bsandro <email@bsandro.tech>
Date:   Wed, 10 Jan 2024 22:17:21 +0200

day 10 p2 cleanup

Diffstat:
Mday10/puzzle.c | 14+-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/day10/puzzle.c b/day10/puzzle.c @@ -166,7 +166,6 @@ int traverse(Map *map, Pos start, Map *loop) { while (is_valid(map, p)) { int offset = p.y*map->w+p.x; loop->area[offset] = map->area[offset]; - //printf("get_next %c %d:%d\n", map->area[offset], p.x, p.y); p = get_next(map, p); offset = p.y*map->w+p.x; len++; @@ -187,7 +186,6 @@ F -> 7 */ bool is_wall_toggles(char cur, char prev) { if (cur=='-') return false; - //if (cur=='|') return prev!=0; if (cur=='J') return prev=='L'; if (cur=='L') return prev=='J'; @@ -195,7 +193,7 @@ bool is_wall_toggles(char cur, char prev) { if (cur=='7') return prev=='F'; if (cur=='F') return prev=='7'; - return false; //prev=='|'; + return false; } /* @@ -227,19 +225,10 @@ int calc_area(Map *loop) { } if (is_wall_continues(sym, prev)) { - //printf("[%2d:%2d] wall continues from %c to %c (%d)\n", y, x, prev, sym, is_open); - //stack_pop(&walls); - //prev = stack_pop(&walls); stack_push(&walls, sym); - //is_open = !is_open; } else if (sym!='-') { is_open = !is_open; stack_push(&walls, sym); - if (is_open) { - printf("[%2d:%2d] wall opened from %c to %c (%d)\n", y, x, prev, sym, is_open); - } else { - printf("[%2d:%2d] wall closed from %c to %c (%d)\n", y, x, prev, sym, is_open); - } } } } @@ -392,7 +381,6 @@ void puzzle(const char *filename, long long *result1, long long *result2) { loop.area[loop.w*start.y+start.x] = dirs2sym(start_dir1, start_dir2); *result2 = calc_area(&loop); - // 3670 is too high map_print(&loop); // mutiny! ignoring feof/ferror.