final ParserComp bug fixes


Ben Kirwin reported a bug on Friday. I hadn't tested the screen reader software very well. I tested that the option was set, but I only briefly checked off on it, and it seemed okay. So what was the offending code? And why did the bug slip through?

Well, it's a bit embarrassing. I did check screen reader mode briefly. The code saying

```

let x be a random allied piece; [pieces are defined as friendly or enemy, and allied is defined as friendly and not the player]

say "You see [x] at [location of x].";

```

When  I ran this, it said "You see the pawn at b6," which was right. But there was more than one ! So I simply got lucky the pawn was chosen when I did my brief walkthrough. More tests and testing would eventually have turned this bug up. In fact, even having a short script to describe the steps through would've almost certainly done so, as the probability it wouldn't have would be (1/2)^8--or, actually, 1/3, since there was a pawn, rook and queen.

That's bad, but what happened next was good. In the mid-comp fix I wrote a script to test all pathways through the game as the player might see them, and ... I saw a weird failure I couldn't reproduce. Thankfully, I copied the script over to grep it and see where things went wrong. The game claimed repetition where there was none.

The gist of the bug was 1) I tracked the moves well enough, but I didn't always correctly keep track of who was to move and 3) I didn't account for whom your ally was. So the result was, the game saw "king on b3, rook on d4, white to move, pawn on c7" as equivalent to "king on b3, rook on d4, white to move, promoted piece on c8." This was a special case for the pivotal moment after promotion, and it *only* happened if the rook fled to d4. Since I tried "rook flees horizontally" as a special randomized case, this was only seen 1 in every 5 times. Once I saw what happened, I noticed I didn't fully track all moves correctly, though the ones I missed on weren't likely to repeat.

So: I missed one bug because I didn't test enough randomness, but while testing the fix, I fixed another bug that only happened sporadically due to randomness. I felt like I got some mojo back with that second fix. They were both relatively low-risk, so I was happy to put them in there.

Files

You Won't Get Her Back-final-comp.zblorb 289 kB
Jul 31, 2022
web-you-wont-get-her-back.zip Play in browser
Jul 31, 2022
you-wont-get-her-back.zip 489 kB
Jul 31, 2022

Get You Won't Get Her Back

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.