Created
August 6, 2012 18:17
-
-
Save mostlygeek/3277297 to your computer and use it in GitHub Desktop.
Revisions
-
mostlygeek revised this gist
Aug 6, 2012 . 1 changed file with 13 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,15 @@ 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 -
mostlygeek revised this gist
Aug 6, 2012 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,10 @@ abstract class Prize case class CoinPrize(multipler: Int) extends Prize case class TicketPrize() extends Prize case class NoPrize() extends Prize class PickGame(prizes: List[Prize]) { ... } val x = new PickGame( NoPrize() * 5 :: TicketPrize() * 4 :: CoinPrize(4) ) -
mostlygeek created this gist
Aug 6, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ abstract class Prize case class CoinPrize(multipler: Int) extends Prize case class TicketPrize() extends Prize case class NoPrize() extends Prize