I want to write this function from here: https://math.stackexchange.com/questions/721494/what-is-the-value-of-this-game
I have written the following, but it doesn't work.
Function value(b As Integer, r As Integer)
If r = 0 Then
value = 0
End If
If b = 0 And r > 0 Then
value = r
End If
If (b < 0 Or r <= 0) Then
value = 0
End If
value(b, r) = (b / (b + r)) * (-1 + value(b - 1, r)) + (r / (b + r)) * (1 + value(b, r-1 ))
End Function
Can someone explain why it doesn't work, I am very new to VBA and programming.