Created
September 4, 2012 00:38
-
-
Save luigip/3615319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val tiles = Map[Char, Int]( | |
'a' -> 1, | |
'b' -> 3, | |
'c' -> 3, | |
'd' -> 2 | |
// etc. | |
) | |
def main(args: Array[String]) { | |
var out = Vector[String]() | |
out ++= Seq( | |
"", | |
"Scrabble Calculator 1.0", | |
"Enter words on the commandline.", | |
"Use a '_' character for blank tiles.", | |
"" | |
) | |
out ++= args map { | |
case w if w.length < 2 => w + ": one-letter words disallowed in Scrabble" | |
case w => w + ": " + (w map tiles).sum + " points" | |
} | |
out foreach println | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment