Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.CompilerServices;
- namespace _04._Darts {
- internal class Program {
- static void Main(string[] args) {
- string playerName = Console.ReadLine();
- string input = Console.ReadLine();
- double beginnerPoints = 301;
- int success = 0;
- int fail = 0;
- while (input != "Retire") {
- int points = int.Parse(Console.ReadLine());
- //if (beginnerPoints < 0)
- //{
- // beginnerPoints = 1;
- //}
- //if (beginnerPoints >= points)
- //{
- // success++;
- //}
- //else
- //{
- // fail++;
- //}
- //if (input == "Single")
- //{
- // beginnerPoints -= points;
- //}
- //else
- if (input == "Double") {
- points *= 2;
- //beginnerPoints -= points;
- } else if (input == "Triple") {
- points *= 3;
- //beginnerPoints -= points;
- }
- if (beginnerPoints >= points) {
- success++;
- beginnerPoints -= points;
- } else {
- fail++;
- }
- if (beginnerPoints == 0 || beginnerPoints == -1) {
- Console.WriteLine($"{playerName} won the leg with {success} shots.");
- //break;
- return;
- }
- input = Console.ReadLine();
- }
- //if (input == "Retire") {
- Console.WriteLine($"{playerName} retired after {fail} unsuccessful shots.");
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement