Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. using System;
  2.  
  3. namespace dartsTournament
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int startPoints = int.Parse(Console.ReadLine());
  10.  
  11. int score = 0;
  12. int counter = 0;
  13.  
  14. while (startPoints > score)
  15. {
  16. string dartsSector = Console.ReadLine();
  17. counter++;
  18.  
  19. if (dartsSector == "bullseye")
  20. {
  21. Console.WriteLine($"Congratulations! You won the game with a bullseye in {counter} moves!");
  22. break;
  23. }
  24.  
  25. int points = int.Parse(Console.ReadLine());
  26.  
  27. if (dartsSector == "double ring")
  28. {
  29. score += points * 2;
  30. }
  31. else if (dartsSector == "triple ring")
  32. {
  33. score += points * 3;
  34. }
  35. else if (dartsSector == "number section")
  36. {
  37. score += points;
  38. }
  39. if (startPoints - score == 0)
  40. {
  41. Console.WriteLine($"Congratulations! You won the game in {counter} moves!");
  42. }
  43. else if (startPoints - score < 0)
  44. {
  45. Console.WriteLine($"Sorry, you lost. Score difference: {score - startPoints}.");
  46. }
  47.  
  48.  
  49. }
  50.  
  51.  
  52.  
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement