public static void Main(string[] args) { Console.WriteLine("Welcome to Bowling 2000\n\nPlease enter your name"); var playerName = Console.ReadLine(); var ball = Ball.Instance; _bowling = new Bowling(playerName); Console.WriteLine($"\nWelcome {playerName}! Press any key to roll your first ball."); Console.ReadLine(); _bowling.Bowl(ball.Roll()); while (_bowling.Status() != GameStatus.Ended) { Console.WriteLine($"Your current score is {_bowling.TotalScore()}"); Console.WriteLine("Press Enter to roll your next ball..."); Console.ReadLine(); _bowling.Bowl(ball.Roll()); } Console.WriteLine($"Congratulations! You scored {_bowling.TotalScore()}"); Console.ReadLine(); Console.ReadLine(); }
public void BowlingGameTotalWithBonus() { _bowling.Bowl(1); _bowling.Bowl(4); Assert.True(_bowling.TotalScore() == 5); _bowling.Bowl(4); _bowling.Bowl(5); Assert.True(_bowling.TotalScore() == 14); _bowling.Bowl(6); _bowling.Bowl(4); _bowling.Bowl(5); Assert.True(_bowling.TotalScore() - 5 == 29); _bowling.Bowl(5); _bowling.Bowl(10); // Assert.True(_bowling.TotalScore() - 10 == 49); _bowling.Bowl(0); _bowling.Bowl(1); Assert.True(_bowling.TotalScore() == 61); _bowling.Bowl(7); _bowling.Bowl(3); _bowling.Bowl(6); Assert.True(_bowling.TotalScore() - 6 == 77); _bowling.Bowl(4); _bowling.Bowl(10); // _bowling.Bowl(2); _bowling.Bowl(8); Assert.True(_bowling.TotalScore() - 10 == 117); _bowling.Bowl(6); _output.WriteLine(_bowling.TotalScore().ToString()); Assert.True(_bowling.TotalScore() == 133); }
public void BasicFrameScoreIsSumOfTwoTries(int firstAttempt, int secondAttempt, int expected) { _bowling.Bowl(firstAttempt); _bowling.Bowl(secondAttempt); var score = _bowling.FrameTotal(1); Assert.True(score == expected); }