diff options
author | Adam Spragg <adam@spra.gg> | 2022-12-31 15:44:09 +0000 |
---|---|---|
committer | Adam Spragg <adam@spra.gg> | 2022-12-31 15:44:09 +0000 |
commit | bfecc1b0323c3c3741840e392999b674ac3576f6 (patch) | |
tree | 1999f67a323f3adabf1cbddbd42716b68984e31d | |
parent | d277dca9e238b938906e1ea942b1d4d2dd0910ec (diff) |
Puzzle 19: Solve part 1 (yay!)
Just generate the output needed by the puzzle.
-rw-r--r-- | 19.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -293,7 +293,7 @@ main(int argc, char ** argv) { int rounds = 24; char const * build = "basic"; - int i; + int quality = 0, i; regex_t reblueprint; char buf[BUFSIZ]; @@ -351,12 +351,14 @@ main(int argc, char ** argv) else if (strcmp(build, "exhaustive") == 0) { exhaustive_iter = 0; inventory_build_exhaustive(&i, &b, rounds); - fprintf(stdout, "Blueprint %d, iterations %ld, ore %d/%d, clay %d/%d, bsdn %d/%d, geod %d/%d\n", +#if 0 + fprintf(stderr, "Blueprint %d, iterations %ld, ore %d/%d, clay %d/%d, bsdn %d/%d, geod %d/%d\n", b.id, exhaustive_iter, i.ore.amount, i.ore.robots, i.clay.amount, i.clay.robots, i.bsdn.amount, i.bsdn.robots, i.geod.amount, i.geod.robots); +#endif } else { fprintf(stderr, "Unknown build strategy: %s\n", build); @@ -364,9 +366,14 @@ main(int argc, char ** argv) return -1; } - printf("Blueprint %d geodes = %d\n", b.id, i.geod.amount); + quality += b.id * i.geod.amount; +#if 0 + fprintf(stderr, "Blueprint %d geodes = %d\n", b.id, i.geod.amount); +#endif } + printf("Total quality level = %d\n", quality); + regfree(&reblueprint); return 0; |