summaryrefslogtreecommitdiff
path: root/gnosis-algorithm.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-06 11:32:20 +0300
committerThanos Apollo <[email protected]>2024-08-06 11:32:20 +0300
commit3ad0c10df188b18517570edc5665669caddbdcb9 (patch)
tree3c9c4e4df26c28e8e89e07ac29a36edab0e928d3 /gnosis-algorithm.el
parent2f0db47813bb70e265e6039ad99b8cc4142a1be1 (diff)
algorithm-next-gnosis: Update assertions & style.
* Assert epignosis & agnoia as floats. * fix indentation.
Diffstat (limited to 'gnosis-algorithm.el')
-rw-r--r--gnosis-algorithm.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el
index a36619c..76b1360 100644
--- a/gnosis-algorithm.el
+++ b/gnosis-algorithm.el
@@ -169,15 +169,16 @@ When C-SUCCESSES (consecutive successes) reach ANAGNOSIS,
increase gnosis-plus by EPIGNOSIS.
When C-FAILURES reach ANAGOSNIS, increase gnosis-minus by AGNOIA."
- (cl-assert (listp gnosis) nil "Assertion failed: gnosis must be a list")
+ (cl-assert (listp gnosis) nil "Assertion failed: gnosis must be a list of floats.")
(cl-assert (booleanp success) nil "Assertion failed: success must be a boolean value")
- (cl-assert (numberp epignosis) nil "Assertion failed: epignosis must be a number")
- (cl-assert (numberp agnoia) nil "Assertion failed: agnoia must be a number")
- (cl-assert (numberp anagnosis) nil "Assertion failed: anagosis must be a number")
+ (cl-assert (and (floatp epignosis) (< epignosis 1)) nil "Assertion failed: epignosis must be a float < 1")
+ (cl-assert (and (floatp agnoia) (< agnoia 1)) nil "Assertion failed: agnoia must be a float < 1")
+ (cl-assert (integerp anagnosis) nil "Assertion failed: anagosis must be an integer.")
(let ((anagnosis-p (= (% (max 1 (if success c-successes c-failures)) anagnosis) 0))
- (neo-gnosis (if success
- (gnosis-algorithm-replace-at-index 2 (+ (nth 2 gnosis) (nth 0 gnosis)) gnosis)
- (gnosis-algorithm-replace-at-index 2 (max 1.3 (- (nth 2 gnosis) (nth 1 gnosis))) gnosis))))
+ (neo-gnosis
+ (if success
+ (gnosis-algorithm-replace-at-index 2 (+ (nth 2 gnosis) (nth 0 gnosis)) gnosis)
+ (gnosis-algorithm-replace-at-index 2 (max 1.3 (- (nth 2 gnosis) (nth 1 gnosis))) gnosis))))
;; TODO: Change amnesia & epignosis value upon reaching a lethe or anagnosis event.
(cond ((and success anagnosis-p)
(setf neo-gnosis (gnosis-algorithm-replace-at-index 0 (+ (nth 0 gnosis) epignosis) neo-gnosis)))