Monday, June 02, 2014

Gridiron Solitaire #108: Bugs

Before we discuss bug hunting, here's an image Fredrik drew last week for fumbles:


Every time I think I'm out of energy to work on the game, Fredrik will send me some fantastic new image and it will recharge my battery immediately.

I need to make some decisions related to using the drive canvas versus big images to represent an event. The big images have so much pop that it's tempting to use them for absolutely everything possible, but in some cases, that creates a problem.

Sacks are a good example. The drive canvas will show the progress of the pass receiver as the gain is progressively reduced, and when the gain goes to zero, the quarterback is shown with a defensive lineman heading toward him for the sack. With each card play, the position of the player on the canvas changes, so it's almost a stop-motion animation kind of effect.

That's the problem. I have a little story unfolding on the drive canvas, so do I suddenly cut away at the moment of the sack and put up a big image? I'm doing that for human player touchdowns, so I could do that for human sacks (of the CPU quarterback) as well. I just don't want inconsistent presentation that will confuse people.

The real subject this week, though, is bugs.

I was asked by someone how bugs get fixed. I don't know if there's an ideal method, but here's the process I use.
1. Can I duplicate the bug?
This is the single most important question, because if I can see the bug happen myself, I can go into debug mode, step through code line by line, and see exactly what's causing the problem.

If I can't make the bug happen, it's an entirely different situation. Guessing as a programmer is an unproductive road, at least for me. I can generally have at least a reasonable guess of what might be wrong, but if I can't watch it happen and I change code as a guess, how can I verify that I fixed anything?

2. Does the bug happen every time, or is it intermittent?
This is the other big question. Intermittent bugs can be very, very difficult to track down because (for me, at least) they're very counter-intuitive. Stuff that's broken should break every time.

Here's an example of a bug that I'm working on now that is driving me crazy. I added a big image to display when a punt is a touchback (when the punter kicks the ball into the end zone and it's not returned). The most prolific beta tester in history (Tosh) e-mailed and said that on two occasions, he'd seen the big image panel with no image on a touchback. The proper text displayed, but the image area was blank.

I have three "tiers" set up for punting, based on field position. So I set up a grid with each possible tier and direction. Six combinations. Then I tested each situation to see if the touchback image would show.

It did, in all six cases. And I've never seen a blank image on a touchback. So I have a bug that I am 100% sure exists (Tosh has reported dozens and dozens of bugs over time, and he is always correct), but I can't make it happen on my development system.

For now, that's a stalemate.

Site Meter