public
Created

  • Download Gist
gistfile1.scala
Scala
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
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
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.