7 Comments
User's avatar
Phil Vuollet's avatar

Currently reading "The Principles of Product Development Flow: Second Generation Lean Product Development" by Donald G. Reinertsen. The authors show something similar. The example is the lotto. 1/1M chance at a $1M payoff, each ticket is worth $1. But how much is learning the first number worth? $10 because it improves your odds of winning by 10x.

Dale Hagglund's avatar

One of my favourite books.

Chris Adams's avatar

Posting this JavaScript code was very helpful. I ran it in the same browser window where I was reading the email, and I used Gemini to help explain it to me. In about 15 minutes, I learned half a semester's worth of JavaScript structures and geometric means. Thank you!

Ron Jeffries's avatar

Why shouldn't this line:

coins = strategy(coins, Math.random() < 0.5 ? 2 : 0.5);

be

coins = strategy(coins, Math.random() < 0.5 ? 2 : 0.0) ; // note 0.0 not 0.5

Since in the main code you already put coins/2 in the box? In my simulation, possibly erroneous, SD invariably goes broke, or gets down to 1 coin which can't be split, depending.

class TestFlipper:

def test_flip(self):

box = 100

for trial in range(1000):

box = box/2 + (box if random.random() > 0.5 else 0)

assert box < 1

I assume I'm missing something important here ... but it seems to me that a long enough sequence of bad flips will consume any number of prior wins, and thereafter one is stuck.

Kind regards,

R

Kent Beck's avatar

I struggled with the same distinction. Those are two different games requiring different strategies.

Ron Jeffries's avatar

I'll reflect further. But don't we know that with finite resources, any strategy with an even money bet must go broke in the long term? Your experience is more recent and more live than my vague recollection of probability study, no doubt about that.