Skip to content

Implementation of NYT's Spelling Bee game in CLJS for my spouse as a birthday present

Notifications You must be signed in to change notification settings

jaidetree/beecat

Repository files navigation

Beecat

Intro

Scoring

Max score

Ranks are based on a percentage of possible points in a puzzle.

(def ranks
  {0   "Beginner"
   5   "Good Start"
   12  "Moving up"
   19  "Good"
   35  "Solid"
   59  "Nice"
   94  "Great"
   118 "Amazing"
   165 "Genius"})

Example Wordlist

(def answers
  ["awarding"
   "drawing"
   "warding"
   "award"
   "awing"
   "awning"
   "dawn"
   "dawning"
   "draw"
   "drawn"
   "gnaw"
   "gnawing"
   "indrawn"
   "inward"
   "wadding"
   "wading"
   "wagging"
   "waging"
   "wand"
   "waning"
   "wanna"
   "ward"
   "warn"
   "warning"
   "warring"
   "wigging"
   "wigwag"
   "wigwagging"
   "wind"
   "winding"
   "windward"
   "wing"
   "wingding"
   "winging"
   "wining"
   "winning"
   "wiring"
   "wring"
   "wringing"])

Pangrams

(def pangrams #{"awarding" "drawing" "warding"})

Valid letters

(def letters ["w","a","d","g","i","n","r"])

Required letter

(def required-letter "w")

Observed points

(def points
  {"Wand"     1
   "Windward" 8
   "Drawn"    5
   "Gnaw"     1
   "Gnawing"  7})

Breakdown

  • 4 letter words are worth 1 point
  • > 4 letter words are worth their length
  • Pangrams are worth 7 + their length
  • Genius is 70% of total points

Test

(defn score-word
  [word]
  (let [length (count word)]
    (cond
      (contains? pangrams word)
      (+ 7 length)

      (> length 4)
      length

      :else
      1)))

(def total
  (->> answers
       (map score-word)
       (reduce + 0)))

Figure out rank percentages

(->> ranks
     (map (fn [[words rank]]
            [(/ words total) rank]))
     (sort-by first)
     (into []))

About

Implementation of NYT's Spelling Bee game in CLJS for my spouse as a birthday present

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages