Skip to content

Instantly share code, notes, and snippets.

@luigip
Created September 4, 2012 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luigip/3615319 to your computer and use it in GitHub Desktop.
Save luigip/3615319 to your computer and use it in GitHub Desktop.
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