My way of dealing with the last 3 frames. I like it because there’s only one return for each type of action. Where can this fail?
if (bowl >= 19 && Bowl21Awarded())
{
if (bowl == 20 && bowls[19 - 1] == 10 && pins < 10) // Frame 19 is a strike, and frame 20 isn't
{
bowl++;
return Action.Tidy;
}
bowl++;
return Action.Reset;
}
else if (bowl == 20 && !Bowl21Awarded())
{
return Action.EndGame;
}