X-Git-Url: https://git.cworth.org/git?p=mnemon;a=blobdiff_plain;f=mnemon.c;h=f4af000a5e413cc59a71860cec0c18f429c5ccb8;hp=9f28dfeb7a88dce584484c5648fafa0b75e49f6e;hb=65180490193e204cbf150953d598bcadc57171d1;hpb=8b5aa52c7a54686d9b4b9d8d117d490eb3b66ba6 diff --git a/mnemon.c b/mnemon.c index 9f28dfe..f4af000 100644 --- a/mnemon.c +++ b/mnemon.c @@ -627,14 +627,15 @@ mnemon_select_item (mnemon_t *mnemon, static void mnemon_do_challenges (mnemon_t *mnemon, - int to_introduce) + int to_introduce, + int to_master) { bin_t *bin; int item_index; item_t *item; char *response; bool_t correct; - int unlearned; + int unlearned, mastered = 0; int i; /* Count the number of items with negative scores. */ @@ -708,14 +709,20 @@ mnemon_do_challenges (mnemon_t *mnemon, } else { printf (" %s is the correct answer.", item->response); - if (item->score >= 0) - unlearned++; - item->score--; /* Penalize an incorrect response by forcing the score * negative. */ if (item->score >= 0) { - item->score = -1; - printf ( " Oops, you knew that, right?\n "); + if (item->score > 0) + printf ( " Oops, you knew that, right?\n "); + unlearned++; + 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 + * a correct response without any learning). */ + item->score = -2; + } else { + item->score--; } } @@ -726,20 +733,28 @@ mnemon_do_challenges (mnemon_t *mnemon, printf (" "); if (unlearned) printf ("%d still unlearned.", unlearned); - if (to_introduce == 0 && unlearned == 0) - printf ("Great job!"); + if (to_introduce == 0 && unlearned == 0) { + if (mastered < to_master) + printf ("%d items to master", + to_master - mastered); + else + printf ("Great job!"); + mastered++; + } printf (")\n\n"); bin = mnemon_get_bin (mnemon, item->score); bin_add_item (bin, item); - } while (unlearned || to_introduce); + } while (mastered <= to_master); } int main (int argc, char *argv[]) { mnemon_t mnemon; + int to_introduce = 3; + int to_master = 10; srand (time (NULL)); @@ -747,7 +762,9 @@ main (int argc, char *argv[]) mnemon_load (&mnemon); - mnemon_do_challenges (&mnemon, 10); + mnemon_do_challenges (&mnemon, + to_introduce, + to_master); mnemon_save (&mnemon);