Skip to content

Instantly share code, notes, and snippets.

@bartosz-witkowski
Created September 3, 2016 09:34
Show Gist options
  • Save bartosz-witkowski/8c9879702aaed92042cf6bed8f657c67 to your computer and use it in GitHub Desktop.
Save bartosz-witkowski/8c9879702aaed92042cf6bed8f657c67 to your computer and use it in GitHub Desktop.
def f(w: Int, b: Int): Double = 0.5 * (w / (w + b)) + 0.5 * ((50 - w)/(100 - w - b))
val wbs = (for (w <- 0 to 50; b <- 0 to 50) yield (w, b)).tail
wbs.map { t => (t, f(t._1, t._2)) }.maxBy(_._2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment