Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
Created August 6, 2012 18:17
Show Gist options
  • Select an option

  • Save mostlygeek/3277297 to your computer and use it in GitHub Desktop.

Select an option

Save mostlygeek/3277297 to your computer and use it in GitHub Desktop.

Revisions

  1. mostlygeek revised this gist Aug 6, 2012. 1 changed file with 13 additions and 8 deletions.
    21 changes: 13 additions & 8 deletions blah.scala
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,15 @@
    abstract class Prize
    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

    class PickGame(prizes: List[Prize]) {
    ...
    }

    val x = new PickGame( NoPrize() * 5 :: TicketPrize() * 4 :: CoinPrize(4) )
    case class NoPrize() extends Prize
  2. mostlygeek revised this gist Aug 6, 2012. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion blah.scala
    Original 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
    case class NoPrize() extends Prize

    class PickGame(prizes: List[Prize]) {
    ...
    }

    val x = new PickGame( NoPrize() * 5 :: TicketPrize() * 4 :: CoinPrize(4) )
  3. mostlygeek created this gist Aug 6, 2012.
    4 changes: 4 additions & 0 deletions blah.scala
    Original 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