Skip to content

Instantly share code, notes, and snippets.

@pwightman
Last active August 29, 2015 13:56
Show Gist options
  • Save pwightman/9040015 to your computer and use it in GitHub Desktop.
Save pwightman/9040015 to your computer and use it in GitHub Desktop.
Better Letterpress Solver
(ns letterpress-solver.core
(:require [clojure.string :as string])
(:require [multiset.core :as ms]))
(def board-letters "srrbtsdofaghvypksbkkbegnv")
(def letterpress-wordlist (string/split-lines (slurp "resources/wordlist.txt")))
(defn -main [& args]
(println "Began...")
(let [ms-letters (apply ms/multiset letters)
words (reduce (fn [found-words w]
(if (ms/subset? (apply ms/multiset w) ms-letters)
(conj found-words w)
found-words))
'()
letterpress-wordlist)]
(println (sort-by count words))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment