]> git.cworth.org Git - wordgame/commitdiff
Don't print empty found/missed sections
authorCarl Worth <cworth@raht.cworth.org>
Sat, 23 Sep 2006 10:56:00 +0000 (03:56 -0700)
committerCarl Worth <cworth@raht.cworth.org>
Sat, 23 Sep 2006 10:56:00 +0000 (03:56 -0700)
word-game.c

index e12787d4e8abc33a62f1b99a6174eddd69f7b894..d4fa77e822582cc82086fc17779857a9baacaaad 100644 (file)
@@ -148,12 +148,17 @@ word_game_play (const char        *puzzle,
 
     printf ("%s\n", puzzle);
 
-    printf ("Words you found:\n");
-    dict_print_by_length_if (answers, seen_predicate);
+    if (found_total) {
+       printf ("Words you found:\n");
+       dict_print_by_length_if (answers, seen_predicate);
+       printf ("\n");
+    }
 
-    printf ("\nWords you missed:\n");
-    dict_print_by_length_if (answers, unseen_predicate);
-    printf ("\n");
+    if (found_total < possible_total) {
+       printf ("Words you missed:\n");
+       dict_print_by_length_if (answers, unseen_predicate);
+       printf ("\n");
+    }
 
     printf ("You found %d of %d words (%.2f%%)\n",
            found_total, possible_total,