ScoreDisplay tests pass but strikes actually display as -/

I was play testing my game and discovered a bug in my game. Instead of displaying X for a strike it would display as -/ and if there is a spare in the previous frame no score bonus is given because the next bowl is 0. I wrote tests for ScoreMaster and ScoreDisplay using my scores and the tests pass. My ScoreMaster, my ScoreMaster test, my ScoreDisplay, and my ScoreDisplay test.

After some debugging using Visual Studio and some code tweaking, I found that the line adding 0 after a strike, rolls.Insert (i, 0);, appears to cause the 0 to get added before the strike, this causes my ScoreDisplay to interpret this as a spare. I have not yet been able to determine the fix for this bug. I tried inserting the 0 in i+1 and while this causes the strike to display it puts a 0 in the first bowl of the next frame.

I was able to fix the problem. For some reason when ActionMaster would add a 0 to the rolls it would add to the GameMaster’s rolls list, which was causing the problem. By creating a new List in ActionManager and putting the values from the list into it and using the new list instead of the rolls list passed in this problem no longer occurs.

5 Likes

Privacy & Terms