summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--org-fc-algo-tn.el47
-rw-r--r--org-fc-review.el16
2 files changed, 35 insertions, 28 deletions
diff --git a/org-fc-algo-tn.el b/org-fc-algo-tn.el
index 7b4f1bc..44583c6 100644
--- a/org-fc-algo-tn.el
+++ b/org-fc-algo-tn.el
@@ -4,34 +4,43 @@
(defun nth-tn (n)
"The mathematical formula for the Nth triangular number."
- (/ (* n
- (1+ n))
+ (/ (* n (1+ n))
2))
(defun org-fc-algo-tn-next-parameters (ease box interval rating)
"Calculate the next parameters of a card, based on the review RATING.
EASE, BOX and INTERVAL are the current parameters of the card."
- (let* ((incorrect-at-edge (and (eq rating 'incorrect)
- (eq box 1)))
- (incorrect (eq rating 'incorrect))
- (correct t)
- (next-ease (cond (incorrect-at-edge (- ease 0.01))
- (incorrect (- ease 0.01))
- (correct ease)))
- (next-box (cond (incorrect-at-edge box)
- (incorrect (1- box))
- (correct 1+ box)))
- (next-interval (cond (incorrect-at-edge 1)
- (incorrect (nth-tn next-box))
- (correct (nth-tn next-box)))))
+ (let*
+ ((incorrect-at-edge
+ (and
+ (eq rating 'incorrect)
+ (eq box 0)))
+ (incorrect (eq rating 'incorrect))
+ (correct t)
+ (next-ease
+ (cond
+ (incorrect-at-edge (1- ease))
+ (incorrect (1- ease))
+ (correct ease)))
+ (next-box
+ (cond
+ (incorrect-at-edge box)
+ (incorrect (1- box))
+ (correct (1+ box))))
+ (next-interval
+ (cond
+ (incorrect-at-edge 0)
+ (incorrect (nth-tn next-box))
+ (correct (nth-tn next-box)))))
(list next-ease next-box next-interval)))
(defun org-fc-algo-tn-initial-review-data (position)
"Initial TN review data for POSITION."
- (let ((box 1)
- (ease 1)
- (interval 1)
- (due (org-fc-timestamp-in 0)))
+ (let
+ ((box 0)
+ (ease 100)
+ (interval 0)
+ (due (org-fc-timestamp-in 0)))
(list position ease box interval due)))
;;; Footer
diff --git a/org-fc-review.el b/org-fc-review.el
index e0e882b..c96a159 100644
--- a/org-fc-review.el
+++ b/org-fc-review.el
@@ -477,15 +477,13 @@ removed."
(defun org-fc-review-add-rating (session rating)
"Store RATING in the review history of SESSION."
(with-slots (ratings) session
- (if (eq org-fc-algorithm 'tn)
- (cl-case rating
- ('incorrect (cl-incf (cl-getf ratings :incorrect) 1))
- ('correct (cl-incf (cl-getf ratings :correct) 1)))
- (cl-case rating
- ('again (cl-incf (cl-getf ratings :again) 1))
- ('hard (cl-incf (cl-getf ratings :hard) 1))
- ('good (cl-incf (cl-getf ratings :good) 1))
- ('easy (cl-incf (cl-getf ratings :easy) 1))))
+ (cl-case rating
+ ;; ('incorrect (cl-incf (cl-getf ratings :incorrect) 1))
+ ;; ('correct (cl-incf (cl-getf ratings :correct) 1))
+ ('again (cl-incf (cl-getf ratings :again) 1))
+ ('hard (cl-incf (cl-getf ratings :hard) 1))
+ ('good (cl-incf (cl-getf ratings :good) 1))
+ ('easy (cl-incf (cl-getf ratings :easy) 1)))
(cl-incf (cl-getf ratings :total 1))))
;;; Header Line