Chess Problem solved in Scala