Add support for counting hands in the Scala back-end.