public void UpdateRollOneScore(RollOneScore rollOneScore) { var frame = GetFrame(rollOneScore.FrameNumber); var playerScore = GetPlayerScore(frame, rollOneScore.PlayerId); UpdateRollOne(rollOneScore, playerScore); if (frame.FrameNumber > 1 && frame.FrameNumber < 11) { PlayerScore previousFramePlayerScore = GetPreviousFramePlayerScore(rollOneScore, frame); if (previousFramePlayerScore.FirstRoll.WasStrike && playerScore.FirstRoll.WasStrike) { previousFramePlayerScore.TotalPoints += 10; playerScore.TotalPoints += previousFramePlayerScore.TotalPoints; } if (previousFramePlayerScore.SecondRoll.WasSpare) { previousFramePlayerScore.TotalPoints += rollOneScore.NumberOfPinsKnockedDown; playerScore.TotalPoints += previousFramePlayerScore.TotalPoints; } } playerScore.TotalPoints += rollOneScore.NumberOfPinsKnockedDown; }
private void UpdateRollOne(RollOneScore rollOneScore, PlayerScore playerScore) { playerScore.FirstRoll.Points = rollOneScore.NumberOfPinsKnockedDown; playerScore.FirstRoll.WasStrike = rollOneScore.WasStrike; }