From: Carl Worth <cworth@raht.cworth.org>
Date: Sat, 23 Sep 2006 10:56:00 +0000 (-0700)
Subject: Don't print empty found/missed sections
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=95950fcacd327b24eb22bad24d15f377c0640e2c;p=wordgame

Don't print empty found/missed sections
---

diff --git a/word-game.c b/word-game.c
index e12787d..d4fa77e 100644
--- a/word-game.c
+++ b/word-game.c
@@ -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,