February 27th, 2016

Tall ships (porthole)

The continuing saga of the laptop adventures

It's been a while since I last posted a status update on the laptop. I'd finally gotten enough of the IBM Lenovo utilities installed that it was approximately functional, but ended up running into a serious stability issue with the wifi software (to the point where the wifi card refused to enable its radio). Since I rather want working wifi, I spent an evening churning through drivers until I found a combination that works.

Step 1 is to totally ignore the supported versions listed in the release notes. They're full of lies and claim that my laptop (an R50p with an Intel 2915ABG wifi card) is supported when the installer thinks otherwise (except when they claim my laptop is unsupported and then install anyway). Fortunately Lenovo are nicer than most and provide download links for older versions, and so after trying multiple ones I eventually ended up with:

Access Connections v6.26.79
Hotkey Features Integration v3.81.0100 (later versions refuse to install)
Power Manager v6.68 (but see below...)
Protip: binary search is the way to do this, as O(log n) is much faster than O(n).

That combination all installed and seemed to mostly behave - importantly, I could now enable the wifi radio again! However that's not the end of the story, because now that I had the power management tools installed I fired that up to put together a better power scheme than the default, and in the process apparently crashed the embedded controller. And wouldn't you know, but the embedded controller is responsible for such things as making the keyboard work. And the mouse. And the display. And, most annoyingly, the power button. The only way to reset it is to remove the battery.

Some searching threw up a known bug where the embedded controller hangs if queried for detailed battery status - I suspect that the power management tools triggered this, as I'm using a significantly newer and shinier version than what was available when I was running XP on the laptop. So, next task is to try older versions of that until I find one that no longer triggers the crash.

On the hardware side of things, the improved heatsink turned up and is waiting to be installed. However the processor upgrade did not appear - the online tracking shows that it never made it from China to Europe and the random eBay seller was not particularly helpful when I initially prodded them over it. I can't be bothered to dispute the transaction for all of £10, so I'll probably try again with a hopefully slightly-less-shady eBay seller.
Ravenclaw maths

StreetPass Battle maths

So one of the extra minigames in StreetPass Mii Plaza is StreetPass Battle, wherein you defeat a succession of opposing empires in a best-of-three succession of battles with a rock-paper-scissors-like type system (type disadvantage wipes out half your troops, then largest army wins). There's some skill in that you can choose how your army is split into cavalry/archers/infantry and then pick which group to send into each battle - with care (and careful use of the spy ability) you can defeat much larger opposing armies.

This all falls apart against the final empire which is a straight run of five battles with each side's entire army. The loser of each battle loses half their troops, and whoever's army is biggest at the end wins. I think the AI's play is random here - certainly it's not the same pattern on each attempt, and rock-paper-scissors has limited scope for trying to be smart.

Anyway, the other day I realised that the odds change in steps as my army grows - adding ten soldiers won't change them, but adding enough to put me over 50% of the opposing army size will. So I thought a bit more and started working the various odds out...

Let's start with my current army, which contains 138,121 soldiers. The final empire has I believe a fixed size of 290,143. To win I have to end the five battles with more soldiers than the AI - obviously, if I win all five battles then I win because the AI will be left with 290,143 ÷ 25 = 9066 soldiers (give or take a few depending on how the game rounds the numbers). But how many battles do I actually need to win?

The answer is two. After winning the first the AI has 145,071 soldiers which is still larger than my army, but a second win reduces that to 72,535 which is less than my army. But I then have to maintain that lead, so I must at a minimum tie the remaining three battles. All in all (and if my vague memories of probability math are right), this gives me a chance of winning of (⅓)2 × (⅔)3 = 0.0329 or about 1 in 30ish which is rubbish. Except there's another path to a win - if I win three battles, I can then lose one and still end up on top (with a result of 69,060 against 36,267). That's got a chance of um... 3 wins times 1 any-result times 1 tie-or-win = (⅓)3 × 1 × ⅔ = 0.0247 or 1 in 40. Overall my chance of success is 1 in 17ish which is still rubbish, and tells me that there's really no point challenging the AI until I get a few more soldiers.

Like, oh, another 6951 or so (surprisingly easy as your army grows based on the size of armies that you StreetPass). At that point with my 145,072 soldiers I can achieve a win with any of:

One win and four draws (or better) = ⅓ × (⅔)4 = 0.0658
Two wins, a loss, and two draws = (⅓)2 × 1 × (⅔)2 = 0.0494
Three wins and two losses = (⅓)3 × 12 = 0.0370

Basically I have to win at least one more time than the AI does. Added up this gives me a chance of victory of 0.152 or better than 1 in 7. So, waiting until I get a few more troops will more than double my chance of success. Nice!

For even more fun, if I hold off until my army is larger than the AI's then the AI now has to win more than me, and I get a 6 in 7 chance of splatting it. So I could just wait until that happens. Or thinking about it, could I expect a win with fewer troops? I've not mentioned that there is a penalty to losing in that 10% of your army runs away, so I'd have to rebuild between battles... but if my army is large enough, then I could run battles back-to-back and have a good overall chance of winning one of them. So, if I have 145,072 × 1.16 = 257,003 soldiers (probably a little more - remember, rounding) then I get 7 attempts before dropping below half the enemy size and have a better than 50% chance of seeing one win out of those attempts. Each attempt still only has a 1 in 7 chance of success so my statement earlier about army size and thresholds still applies - in fact, if I'm patient and wait to replenish my army after each loss I can get by with even less troops. If I lose 6 back-to-back battles then overall 111,931 soldiers run away, but if I fight 6 battles at 145,072 and wait to rebuild after each one than I only lose 87,043 troops.

So, I think the most economical way to sensibly see a win is to battle each and every time I reach 145,072 soldiers, and that'll likely take 7 battles and cost me 87,043 soldiers from lost battles. Alternatively there's always the brute force approach - if I ever get to 8,224,097 soldiers then I will win, because the AI can win all five skirmishes and I'll still have more soldiers left... but accumulating that many will take ages and many play coins...
The path to world conquest is not easy, but let us give it our all!
Wentworth, StreetPass Battle