aboutsummaryrefslogtreecommitdiff
path: root/src/alg.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-02-27 18:33:31 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2024-02-27 18:33:31 +0100
commit98b8339bceb833eb2419bc349547cb8342e4be1a (patch)
treeed8ee56446b874500f733b60985c6fcf645f829d /src/alg.c
parent9afb1a31f456b82f87539569055a76d23d0490b4 (diff)
downloadnissy-classic-98b8339bceb833eb2419bc349547cb8342e4be1a.tar.gz
nissy-classic-98b8339bceb833eb2419bc349547cb8342e4be1a.zip
Print solutions to stderr when using -v
Diffstat (limited to '')
-rw-r--r--src/alg.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/alg.c b/src/alg.c
index f00453d..fbe1105 100644
--- a/src/alg.c
+++ b/src/alg.c
@@ -423,7 +423,7 @@ on_inverse(Alg *alg)
423} 423}
424 424
425void 425void
426print_alg(Alg *alg, bool l) 426print_alg(FILE *out, Alg *alg, bool l)
427{ 427{
428 char fill[4]; 428 char fill[4];
429 int i; 429 int i;
@@ -437,25 +437,25 @@ print_alg(Alg *alg, bool l)
437 if (niss == alg->inv[i]) 437 if (niss == alg->inv[i])
438 strcpy(fill, i == 0 ? "" : " "); 438 strcpy(fill, i == 0 ? "" : " ");
439 439
440 printf("%s%s", fill, move_string(alg->move[i])); 440 fprintf(out, "%s%s", fill, move_string(alg->move[i]));
441 niss = alg->inv[i]; 441 niss = alg->inv[i];
442 } 442 }
443 443
444 if (niss) 444 if (niss)
445 printf(")"); 445 fprintf(out, ")");
446 if (l) 446 if (l)
447 printf(" (%d)", alg->len); 447 fprintf(out, " (%d)", alg->len);
448 448
449 printf("\n"); 449 fprintf(out, "\n");
450} 450}
451 451
452void 452void
453print_alglist(AlgList *al, bool l) 453print_alglist(FILE *out, AlgList *al, bool l)
454{ 454{
455 AlgListNode *i; 455 AlgListNode *i;
456 456
457 for (i = al->first; i != NULL; i = i->next) 457 for (i = al->first; i != NULL; i = i->next)
458 print_alg(i->alg, l); 458 print_alg(out, i->alg, l);
459} 459}
460 460
461static void 461static void

Generated with cgit - Back to sebastiano.tronto.net