Skip to content

Instantly share code, notes, and snippets.

View AlvaroCaste's full-sized avatar
👋

Álvaro Castellanos López AlvaroCaste

👋
  • LeadIQ
  • Spain
View GitHub Profile
package bowling
import org.scalacheck.Gen
import org.scalatest.{ShouldMatchers, FlatSpec}
import org.scalatest.prop.PropertyChecks
class BowlingTest extends FlatSpec with ShouldMatchers with PropertyChecks {
val rolls = Gen.chooseNum(0, Game.TotalPins)
package bowling
object Game {
val TotalPins = 10
val TotalFrames = 10
def scoreFor(line: Line): Int = sum(line.rolls, TotalFrames)
private def sum(rolls: Seq[Int], remainingFrames: Int): Int =
if (remainingFrames == 0) 0