fork download
  1. (defun get-date-string ()
  2. (multiple-value-bind (sec min hour day month year)
  3. (get-decoded-time) ;;
  4. (format nil "~4,'0D-~2,'0D-~2,'0D" year month day)))
  5.  
  6. (defun fortunecookie ()
  7. (format t "名前または学籍番号を入力:~%")
  8. (let* ((id (read-line))
  9. (date (get-date-string))
  10. (key (concatenate 'string id date))
  11. (seed (reduce #'+ (map 'list #'char-code key)))
  12. (result (nth (mod seed 5)
  13. '("大吉!挑戦を続けよう"
  14. "中吉!今日は集中の日"
  15. "小吉!まずは一歩"
  16. "吉!粘り勝ちを目指そう"
  17. "凶…でも明日がある!"))))
  18. (format t "~%【~A の運勢 ~A】~%~A~%" id date result)))
  19.  
  20. (fortunecookie)
  21.  
Success #stdin #stdout 0.02s 29296KB
stdin
岩田哉人
stdout
名前または学籍番号を入力:

【岩田哉人 の運勢 2025-06-19】
凶…でも明日がある!