From 25479a6ba2eee01639937ba63fba683bfee5a977 Mon Sep 17 00:00:00 2001 From: Adam Spragg Date: Wed, 18 Jan 2023 14:16:15 +0000 Subject: Puzzle 16: Improve debug output --- 16.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/16.c b/16.c index 4dff42c..6ad137e 100644 --- a/16.c +++ b/16.c @@ -157,7 +157,6 @@ valve_setdests(struct valve * v, struct valve * others, int nothers) } -#if 0 void valve_distances_dump(struct valve const * valves, int nvalves, int * dists) { @@ -178,7 +177,6 @@ valve_distances_dump(struct valve const * valves, int nvalves, int * dists) } fprintf(stderr, "\n"); } -#endif // Precalculate distances between all pairs of valves @@ -318,6 +316,8 @@ main(int argc, char ** argv) // Calculate distances between all valves dists = valve_distances(valves, nvalves); + if (debug) + valve_distances_dump(valves, nvalves, dists); // Find start position for (v = valves; v < valves + nvalves && !start; ++v) { @@ -369,6 +369,7 @@ main(int argc, char ** argv) // Is it a new high? if (flow > max) { + max = flow; if (debug) { int j; fprintf(stderr, "Found new max flow: %d: %s", max, start->name); @@ -376,7 +377,6 @@ main(int argc, char ** argv) fprintf(stderr, "->%s", path[j]->name); fprintf(stderr, "\n"); } - max = flow; } if (i < nflows) { -- cgit v1.2.1