Hand evaluator translated to Scala