aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-21 07:44:34 -0500
committerColin Okay <colin@cicadas.surf>2022-07-21 07:44:34 -0500
commit2518a1a0f4b27776c7b3af5717552f192809ad9e (patch)
treef2dd5628e0801a78b87609292226d8397dcc9d0b
parent9872dbb398917fd0e4ff3a1765b64cc79467ba79 (diff)
[refactor] lifecoach. improved feeling of randomness
-rw-r--r--init-el.org27
1 files changed, 20 insertions, 7 deletions
diff --git a/init-el.org b/init-el.org
index 79ab485..4efa689 100644
--- a/init-el.org
+++ b/init-el.org
@@ -1919,11 +1919,10 @@ messages echo to the echo area.
"There is one path in the world that non can walk but you. Where does it lead? Don't ask, Walk!"
"Get it done. Then start the next one!"
"Interact! Hack forward!"
- "Money would be nice. Thinking about it wont help. Ship!"
"This is your work. Love it!"
"What if it works? Don't give up!"
- "Dont play the finite games. Keep making moves!"
- "There is no escape from now. Be free here. Love the task!"
+ "Dont play the finite games!"
+ "There is no escape from now!"
"Be Tosk! Challenge the hunter! Surprise him. Delight him."
"Expect anything worthwhile to take a long time. This is worth it!"
"To know what you're going to draw, you must begin drawing!"
@@ -1963,20 +1962,34 @@ messages echo to the echo area.
"Do you understand the why?"
))
+
(setq lifecoach-idle-timer nil)
+(setq lifecoach-index 0)
+(setq permuted-lifecoach-messages nil)
+
+(defun permute-list (ls)
+ "Will not work properly if there are duplicates in LS, as the
+ returned list will not have any duplicates"
+ (when ls
+ (let ((nth
+ (nth (random (length ls)) ls)))
+ (cons nth (permute-list (delete nth ls))))))
(defun lifecoach-message ()
+ (setq lifecoach-index
+ (mod (1+ lifecoach-index) (length permuted-lifecoach-messages)))
(message
"Lifecoach says: %s"
- (nth (random (length lifecoach-messages))
- lifecoach-messages)))
+ (nth lifecoach-index
+ permuted-lifecoach-messages)))
(defun lifecoach-start ()
(interactive)
(when lifecoach-idle-timer
(cancel-timer lifecoach-idle-timer))
- (setf lifecoach-idle-timer
- (run-with-idle-timer 30 t #'lifecoach-message)))
+ (setq
+ permuted-lifecoach-messages (permute-list (copy-seq lifecoach-messages))
+ lifecoach-idle-timer (run-with-idle-timer 30 t #'lifecoach-message)))
(defun lifecoach-stop ()
(interactive)