Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
Created August 6, 2012 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mostlygeek/3277297 to your computer and use it in GitHub Desktop.
Save mostlygeek/3277297 to your computer and use it in GitHub Desktop.
Some Scala
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