improved if exercise; added beforeCode method to GameSpecification