Skip to content

Commit

Permalink
August 2023 puzzles, plus Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
msszczep committed Aug 20, 2023
1 parent 4bd7d41 commit cbfe6ee
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
clean:
lein clean
27 changes: 27 additions & 0 deletions src/clj/puzzle_2023-08-13.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; https://www.npr.org/2023/08/13/1193621080/sunday-puzzle-fill-in-the-blank

; Name a famous contemporary singer (6,4). The second, fourth, sixth, eighth, and ninth letters, in order, spell a repeated part of a song that everyone knows. What is it?

(defn clean-up-word [word]
(clojure.string/replace (clojure.string/lower-case word) #"[^a-z]" ""))

(def six-four
(->> "resources/64.txt"
slurp
clojure.string/split-lines))

(def ospd
(->> "resources/ospd3.txt"
slurp
clojure.string/split-lines
set))

(defn transform-name [n]
(let [[_ a _ b _ c _ _ d e _] (map char n)]
(str a b c d e)))

(def candidates
(->> six-four
(mapv (juxt identity (comp transform-name clean-up-word)))
(filter (comp (partial = 5) count last))
distinct))
22 changes: 22 additions & 0 deletions src/clj/puzzle_2023-08-20.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
; https://www.npr.org/2023/08/20/1194416790/sunday-puzzle-you-better-make-it-last

; Name part of the human body above the neck in 9 letters. Rearrange them
; to name another part of the human body found below the neck. Only some
; people have the first body part. Everyone has the second one. What
; parts of the human body are these?

(defn clean-up-word [word]
(clojure.string/replace (clojure.string/lower-case word) #"[^a-z]" ""))

(def body-parts
(->> "resources/body_parts.txt"
slurp
clojure.string/split-lines
(mapv clean-up-word)))

(def nines
(filter (comp (partial = 9) count) body-parts))

(map val (group-by frequencies nines))


0 comments on commit cbfe6ee

Please sign in to comment.