2048 implemented in Scala