static void Main(string[] args) { Console.WriteLine($"Hello Welcome to Sports runner game analysis (HomeWork 14)"); var gameControl = new Homework14(); var isRunningGame = true; while (isRunningGame) { Console.WriteLine(gameControl.RenderDistance); var displayMessage = gameControl.IsGameEnd ? "Do you want to try again?: " : "Please input a number: "; Console.Write(displayMessage); var input = Console.ReadLine(); switch (input) { case "yes": gameControl.SetupANewGame(); break; case "no": isRunningGame = false; break; default: int.TryParse(input, out int number); gameControl.GetGameResult(number); break; } } }
public void GameCalculate_OddNumber(int number) { var gameControl = new Homework14(); var result = gameControl.GetGameResult(number); var expected = $"Koo (20): ********************{Environment.NewLine}Kee (19): *******************"; Assert.Equal(expected, result); }
static void Main(string[] args) { var svc = new Homework14(); Console.WriteLine(svc.DisplayGameResult()); while (true) { var input = Console.ReadLine(); var result = svc.GetGameResult(int.Parse(input)); Console.WriteLine(result); } }
static void Main(string[] args) { Homework14 hm14 = new Homework14(); Console.WriteLine(hm14.GetGameResult(0)); }
public void GameCalculate_Player2Won() { var gameControl = new Homework14(); var result = gameControl.GetGameResult(5); var expected = $"Koo (20): ********************{Environment.NewLine}Kee (19): *******************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(90); expected = $"Koo (19): *******************{Environment.NewLine}Kee (19): *******************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(3); expected = $"Koo (19): *******************{Environment.NewLine}Kee (18): ******************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(7); expected = $"Koo (19): *******************{Environment.NewLine}Kee (17): *****************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(9); expected = $"Koo (19): *******************{Environment.NewLine}Kee (16): ****************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(2); expected = $"Koo (17): *****************{Environment.NewLine}Kee (16): ****************"; Assert.Equal(expected, result); for (int i = 0; i < 14; i++) { result = gameControl.GetGameResult(3); } result = gameControl.GetGameResult(3); expected = $"Koo (17): *****************{Environment.NewLine}Kee (01): *"; Assert.Equal(expected, result); result = gameControl.GetGameResult(2); expected = $"Koo (10): **********{Environment.NewLine}Kee (01): *"; Assert.Equal(expected, result); result = gameControl.GetGameResult(1); expected = $"Koo (10): **********{Environment.NewLine}Kee (00): {Environment.NewLine}The Winner is MR.Kee"; Assert.Equal(expected, result); gameControl.SetupANewGame(); result = gameControl.RenderDistance; expected = $"Koo (20): ********************{Environment.NewLine}Kee (20): ********************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(5); expected = $"Koo (20): ********************{Environment.NewLine}Kee (19): *******************"; Assert.Equal(expected, result); }
public void GameCalculate_InputNumber_EvenGameIsEnd() { var gameControl = new Homework14(); var result = gameControl.GetGameResult(5); var expected = $"Koo (20): ********************{Environment.NewLine}Kee (19): *******************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(90); expected = $"Koo (19): *******************{Environment.NewLine}Kee (19): *******************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(3); expected = $"Koo (19): *******************{Environment.NewLine}Kee (18): ******************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(7); expected = $"Koo (19): *******************{Environment.NewLine}Kee (17): *****************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(9); expected = $"Koo (19): *******************{Environment.NewLine}Kee (16): ****************"; Assert.Equal(expected, result); result = gameControl.GetGameResult(2); expected = $"Koo (17): *****************{Environment.NewLine}Kee (16): ****************"; Assert.Equal(expected, result); for (int i = 0; i < 14; i++) { result = gameControl.GetGameResult(3); } result = gameControl.GetGameResult(3); expected = $"Koo (17): *****************{Environment.NewLine}Kee (01): *"; Assert.Equal(expected, result); result = gameControl.GetGameResult(2); expected = $"Koo (10): **********{Environment.NewLine}Kee (01): *"; Assert.Equal(expected, result); result = gameControl.GetGameResult(1); expected = $"Koo (10): **********{Environment.NewLine}Kee (00): {Environment.NewLine}The Winner is MR.Kee"; Assert.Equal(expected, result); result = gameControl.GetGameResult(1); expected = $"Koo (10): **********{Environment.NewLine}Kee (00): {Environment.NewLine}The Winner is MR.Kee"; Assert.Equal(expected, result); result = gameControl.GetGameResult(2); expected = $"Koo (10): **********{Environment.NewLine}Kee (00): {Environment.NewLine}The Winner is MR.Kee"; Assert.Equal(expected, result); }