diff options
author | Adam Spragg <adam@spra.gg> | 2023-01-18 14:16:15 +0000 |
---|---|---|
committer | Adam Spragg <adam@spra.gg> | 2023-01-18 14:16:15 +0000 |
commit | 25479a6ba2eee01639937ba63fba683bfee5a977 (patch) | |
tree | 453eab3054ad16c0c0975035f97a90d29288cc46 /16.c | |
parent | 69a900c9b0e720c791f3d3deb28fc8de17f8cc8c (diff) |
Puzzle 16: Improve debug output
Diffstat (limited to '16.c')
-rw-r--r-- | 16.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) { |