archive by month
Skip to content

a mildly funny bug

Today, trying to track down a mysterious regression, I noticed this condition in an if in CombatCommander::getAttackOrder():

enemy.type == enemy.type == BWAPI::UnitTypes::Protoss_High_Templar

Hmm, it looks a little different than I intended. == is left-associative, so this always evaluates to true. The effect is that Steamhammer might make a poor decision of which enemy base to attack. The decision is pretty rough anyway, though, so the buggy decision is not much worse.

Gotta love edit slip bugs, they are so creative. In this case, the original intention is also wrong, because high templar are excluded by an earlier check—the condition would have always been false.

If only I could find the bugs that matter, instead of the bugs that don’t hurt much....

Trackbacks

No Trackbacks

Comments

McRave on :

I had a similar funny bug a while ago where I tried to create UnitTypes::Hero_Dark_Templar.

That took a while to find!

Joseph Huang on :

Have you considered using enemy combat sim scores for this? Even not running a sim and just looking at initial scores might be good.

Jay Scott on :

Oh yes, I’ve thought of all kinds of information inputs and computations that could help. But it is more or less acceptable as it is, and I want to minimize work on it until I can switch it to machine learning, or at least to the evaluator I thought of. I expect that the machine learning method I have in mind for it will be very effective.

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.