Guest User

05.DartsTourament

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