Sha256: 04d6f07769a7ceeea86f017b163c7e0208203247f060c091607d7e8538920ba9
Contents?: true
Size: 688 Bytes
Versions: 66
Compression:
Stored size: 688 Bytes
Contents
module ScrabbleScore exposing (scoreWord) import String exposing (contains, foldl, fromChar, toUpper) addLetterScore : Char -> Int -> Int addLetterScore s total = let c = toUpper (fromChar s) in if contains c "AEIOULNRST" then total + 1 else if contains c "DG" then total + 2 else if contains c "BCMP" then total + 3 else if contains c "FHVWY" then total + 4 else if contains c "K" then total + 5 else if contains c "JX" then total + 8 else if contains c "QZ" then total + 10 else total scoreWord : String -> Int scoreWord x = x |> foldl addLetterScore 0
Version data entries
66 entries across 66 versions & 1 rubygems