So I’ve been having an issue with getting FormatRolls to work correctly and it stemmed from importing Ben’s actionmaster.
The problem I have is the score display has no concept of how to discern between a strike in the first shot or a spare caused by a strike in the second shot of a frame.
here’s the offending line in actionmaster sending that information back
if (rolls[i] == 10) { rolls.Insert(i, 0); // Insert virtual 0 after strike nextAction = Action.EndTurn; } else { nextAction = Action.Tidy; } }
as you can see it inserts a virtual miss here (which goes before the strike in the list), so my score display things it should display as a Spare (as to the rules of bowling, if you miss then strike, it’s a spare)
Am I alone with this? Is there something I’m missing? All my tests on everything pass, so the individual modules are returning the correct numbers, it’s only when you actually play the game so it’s all working together the issue rears its ugly head.
Edit: I just tried bens FormatRolls and that also comes out wrong.
Edit2: Just spotted this guy had the same issue, but seems to have fixed it by copying the list instead [Solved]ScoreDisplay tests pass but strikes actually display as -/