Vera Duckworth and Huey Lewis?

I've been working on the Cricket game at work. On the actual game itself as well as the web interface, which is nice because my C++ was getting very rusty. It was a bit of a drop in the deep end mind you, as the first things I had to fix was the botched Duckworth-Lewis calculations in the game which change the score the second-batting team needs to achieve to win when a game is shortened by rain.

Actually, that said, the problem was less with coding than with finding out how to implement the “D/L”. Whilst almost all descriptions of it say something along the lines of “[t]he D/L method is relatively simple to apply” they forget to clarify “as long as your score matches one of the examples we've supplied”.

The main problem is that the D/L is actually sooper-seekrit and all they sell is the resulting look-up table. The previous programmer had not only used an old table but also just part of it, averaging out the missing values - meaning the games calculations were generally off. Compounding that, it was always adding its adjustments, which meant that on the occasions were the new target was supposed to be smaller it was in fact much larger.

The other problem is the difficulty in confirming my interpretation of the calculations. I'm all but certain I grok it, but the lack of absolute certainty led me to put up a few examples and solicit feedback from the players. People were mainly happy but a couple were convinced I'd got half of them wrong - though without supplying any calculations to prove it, just generally “feelings” things were wrong. But then, as the WIkipedia page notes: “the D/L method can produce results that are somewhat counterintuitive”.

I think we're going to go live with it Monday. Even if it's slightly wrong, it's an improvement over the current one.

Comments

No comments yet

Add Comments

You'll need to register to post comments.