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:

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. Smile

Maybe I'll port it to a Ti 84 CE Razz Graphing Calculator
Yes, definitely port it to the CE.

I do play Scrabble, so I can tell you that you would definitely have at least one user Very Happy .
I think the main issue for the CE would be the size of the wordlist?
Perhaps have it split up into multiple AppVars (maybe sort them by points or likelihood to have those letters?)
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement