Last active
January 26, 2022 14:10
-
-
Save cataska/56f0f98102a9fbe3f60320e35f0c0550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defconstant +words-filename+ "words.txt") | |
(defun date-to-ms (year month day) | |
(* (encode-universal-time 0 0 0 day month year) 1000)) | |
(defvar *base-date* (date-to-ms 2021 6 19)) | |
(defvar *day-in-ms* 86400000) | |
(defun parse-words-input (pathname) | |
(uiop:read-file-lines pathname)) | |
(defun wordle (year month day) | |
(let* ((words (parse-words-input +words-filename+)) | |
(words-length (list-length words)) | |
(date-diff (floor (- (date-to-ms year month day) *base-date*) *day-in-ms*))) | |
(nth (rem date-diff words-length) words))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment