]> git.cworth.org Git - mnemon/blobdiff - mnemon.c
Ease mastering requirement to not require consecutive success
[mnemon] / mnemon.c
index 3298197cde18d781b02ca19f0c64332ffe0078ec..1ca0939d6fa9f8cdae19d3c7766b640c500a7ffb 100644 (file)
--- a/mnemon.c
+++ b/mnemon.c
@@ -299,9 +299,9 @@ mnemon_init (mnemon_t *mnemon)
     mnemon->bins = NULL;
 
     mnemon->to_introduce = 3;
-    mnemon->to_master = 10;
+    mnemon->to_master = 0;
     mnemon->unlearned = 0;
-    mnemon->mastered = 0;
+    mnemon->mastered = -1;
 }
 
 static void
@@ -746,6 +746,10 @@ mnemon_handle_response (mnemon_t   *mnemon,
            item->score = 1;
            mnemon->unlearned--;
            printf ("You got it!");
+           if (mnemon->unlearned == 0 && mnemon->to_master == 0) {
+               mnemon->to_master = 10;
+               mnemon->mastered = 0;
+           }
        } else if (item->score < 0) {
            printf ("Yes---just give me %d more.",
                    - item->score);
@@ -753,6 +757,8 @@ mnemon_handle_response (mnemon_t    *mnemon,
            printf ("On your first try, no less!");
        } else {
            printf ("Masterful (%dx).", item->score);
+           if (mnemon->to_master)
+               mnemon->mastered++;
        }
     } else {
        printf ("  %s is the correct answer.",
@@ -763,7 +769,6 @@ mnemon_handle_response (mnemon_t    *mnemon,
            if (item->score > 0)
                printf ( " Oops, you knew that, right?\n ");
            mnemon->unlearned++;
-           mnemon->mastered = 0;
            /* We go to -2 to force a little extra reinforcement
             * when re-learning an item, (otherwise, it will often
             * get asked again immediately where it is easy to get
@@ -774,22 +779,19 @@ mnemon_handle_response (mnemon_t  *mnemon,
        }
     }
 
-    printf (" (");
+    printf (" ");
     if (mnemon->to_introduce)
-       printf ("%d to come.", mnemon->to_introduce);
-    if (mnemon->to_introduce && mnemon->unlearned)
-       printf (" ");
+       printf ("%d to come. ", mnemon->to_introduce);
     if (mnemon->unlearned)
-       printf ("%d still unlearned.", mnemon->unlearned);
-    if (mnemon->to_introduce == 0 && mnemon->unlearned == 0) {
+       printf ("%d still unlearned. ", mnemon->unlearned);
+    if (mnemon->to_master) {
        if (mnemon->mastered < mnemon->to_master)
            printf ("%d items to master",
                    mnemon->to_master - mnemon->mastered);
        else
            printf ("Great job!");
-           mnemon->mastered++;
     }
-    printf (")\n\n");
+    printf ("\n\n");
 
     bin = mnemon_get_bin (mnemon, item->score);
 
@@ -860,7 +862,7 @@ mnemon_do_challenges (mnemon_t *mnemon)
 
        mnemon_handle_response (mnemon, bin, item_index,
                                item, response);
-    } while (mnemon->mastered <= mnemon->to_master);
+    } while (mnemon->mastered < mnemon->to_master);
 }
 
 int