This is my first post, so I figured I would post it on forums rather than spamming IRC. I'm wondering, what would be some useful features I could add that would make a Scrabble cheater's life easier?
Code:
This is my Haskell file so you can see the logic.
Maybe I'll port it to a Ti 84 CE
Code:
module Main where
import Control.Monad (forever)
import Data.Char (toUpper)
import Data.List (isSubsequenceOf, sort)
import Data.Set (isSubsetOf)
wordDictionary :: IO [(String, String)]
wordDictionary = map (\x -> (sort x, x)) . lines <$> readFile "wordlist.txt"
findWords :: [([Char], b)] -> [Char] -> [b]
findWords dictionary charseq =
let sortedsequence = sort $ map toUpper charseq
in map snd $ filter (\(x, y) -> x `isSubsequenceOf` sortedsequence) dictionary
main :: IO ()
main = forever $ main' =<< wordDictionary
where
main' dictionary = print . findWords dictionary =<< getLine
This is my Haskell file so you can see the logic.
Maybe I'll port it to a Ti 84 CE