As I've observed before, being a programmer is a little bit (but only a little bit) like being a copper - you're never off duty. Consequently, you probably won't be at all surprised to hear the I was prevailed upon to set up our swimming club website. If you're a programmer yourself, you know what comes next. "Setting up the website" turns into "running the website". Well, that's ok, because it only takes a few minutes every now and then. I've learned a bit about WordPress and confirmed my opinion that PHP is an abomination.
Since Natalie is the club fixtures secretary, she spends a lot of time filling in or checking the times on entry forms for swimming galas and league meets. Swim times are very important - you might not be able to swim in a particular gala if you're too slow, but you might not be able to swim in another because you're too quick. Swimmer's personal bests change all the time but the kids and their parents aren't always very good at keeping track of them. So, alongside the website, I was prevailed upon to put together a swim times database. All the kids, all the times, which stroke, when they swam it, where they swam it, and so on. Quite good fun actually, and I learned a bit about Django and confirmed my opinion that the most irritating thing about Python is not its significant whitespace but the wart that is the trailing colon. (Do not be alarmed if that last sentence makes no sense.)
Generally, when you're filling in your entry form where it says, say, 200m freestyle, you just pop your 200m freestyle time in the box. Makes sense, right? Well, no, because you might have two personal bests for that distance and stroke, one swum in a 25m pool and one swum in a 50m pool. More often than not, the 25m time will be quicker. That's because you will have made more turns, and each time you turn you push off the wall. You also spend more time in a proper streamline position. But, what if your 50m time is quicker? Do you just stick that it in instead? Well, no. If you could swim that fast in a 50m pool, you could swim even quicker in a 25m pool. Your 50m time would be misleading - you might not even qualify for the gala, or if you do you might end up in the wrong heat swimming with people who are slower than you.
To solve this problem, the ASA ran a detailed statistical analysis of swimmers' times and produced a big pile of performance tables. A sort of Duckworth-Lewis method for swimming, but without the catchy name. Armed with your 50m time, you can read down the tables and find your 200m breast stroke time of 03:26.48 translates to a short course time of 03:23.90. So you do that, and everyone's happy.
But checking a pile of tables is kind of tedious when you've 30 entry forms to verify, each with eight or nines times on them. And if you have a database of all the times already, and your husband's a programmer, you can ask him to get the software to do it for you, right? (Actually, it was the other way around. I said I could get the software to do that, and Natalie was genuinely-mouth-fall-open-'you can do that?'-amazed.)
So that's what I've been doing this evening, working from a description of the conversion algorithm provided on the ASA website. As a little 5 minute exercise, try reading it through and see if you can work out what you need to do for the straightforward case of converting a time recorded in a 50m pool to the equivalent time in a 25m pool.