Sha256: dba57e921e2d39813c0dd723d5ec7d464e7b719c803b41cd85471b3a07a6c823

Contents?: true

Size: 745 Bytes

Versions: 306

Compression:

Stored size: 745 Bytes

Contents

module ScrabbleScore exposing (..)

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

306 entries across 306 versions & 1 rubygems

Version Path
trackler-2.2.1.104 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.103 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.102 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.101 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.100 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.99 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.98 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.97 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.96 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.95 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.94 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.93 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.92 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.91 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.90 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.89 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.88 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.87 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.86 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm
trackler-2.2.1.85 tracks/elm/exercises/scrabble-score/ScrabbleScore.example.elm