Skip to content

Instantly share code, notes, and snippets.

@jliszka
Last active January 18, 2016 16:08
Show Gist options
  • Save jliszka/6419f9f1cff5e12f991a to your computer and use it in GitHub Desktop.
Save jliszka/6419f9f1cff5e12f991a to your computer and use it in GitHub Desktop.
def basketball(unseenShots: Int) = {
def prob(outcomes: List[Boolean]) = 1.0 * outcomes.count(m => m) / outcomes.size
val outcomes = always(List(true, false)).markov(unseenShots+1)(outcomes => tf(prob(outcomes)).map(b => b::outcomes)).given(_.head)
val lastShot = for {
outcome <- outcomes
shot <- tf(prob(outcome))
} yield shot
lastShot.pr(a => a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment