From 16ea9ef431682b5339ac94b29d235ea0af5d24a5 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Apr 2007 12:45:51 -0700 Subject: [PATCH] Prevent any item count from being 0 after being asked. --- mnemon.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mnemon.c b/mnemon.c index d28657b..6600798 100644 --- a/mnemon.c +++ b/mnemon.c @@ -651,12 +651,18 @@ mnemon_do_challenges (mnemon_t *mnemon) if (correct) { printf ("Correct! (Moving from %d to ", item->count); item->count++; + /* We reserve an item count of 0 for an item that has + * never been asked. */ + if (item->count == 0) + item->count = 1; printf ("%d)\n\n", item->count); } else { printf (" %s is the correct answer. (Moving from %d to ", item->response, item->count); item->count--; - if (item->count > 0) + /* Penalize an incorrect response by forcing the count + * negative. */ + if (item->count >= 0) item->count = -1; printf ("%d)\n\n", item->count); } -- 2.43.0