Created
August 6, 2012 18:17
-
-
Save mostlygeek/3277297 to your computer and use it in GitHub Desktop.
Some Scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bstract class Prize { | |
def * (num: Int): List[Prize] = { | |
if (num == 0) Nil | |
else { | |
import collection.mutable.ListBuffer | |
val l = new ListBuffer[Prize] | |
for (i <- 1 to num) | |
l += this | |
l.toList | |
} | |
} | |
} | |
case class CoinPrize(multipler: Int) extends Prize | |
case class TicketPrize() extends Prize | |
case class NoPrize() extends Prize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment