Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace _03.WarCards
- {
- class WarCards
- {
- static void Main(string[] args)
- {
- BigInteger numberOfGames = BigInteger.Parse(Console.ReadLine());
- BigInteger scorePlayerOne = 0;
- BigInteger scorePlayerTwo = 0;
- BigInteger temp = 0;
- BigInteger temp1 = 0;
- BigInteger gamesWon1 = 0;
- BigInteger gamesWon2 = 0;
- for (int i = 0; i < numberOfGames; i++)
- {
- int cardOne = 0;
- int cardTwo = 0;
- int cardThree = 0;
- BigInteger xCounter1 = 0;
- BigInteger xCounter2 = 0;
- string[] arr = new string[3];
- arr[0] = Console.ReadLine();
- arr[1] = Console.ReadLine();
- arr[2] = Console.ReadLine();
- if (arr[0] == "2")
- {
- cardOne = 10;
- }
- if (arr[0] == "3")
- {
- cardOne = 9;
- }
- if (arr[0] == "4")
- {
- cardOne = 8;
- }
- if (arr[0] == "5")
- {
- cardOne = 7;
- }
- if (arr[0] == "6")
- {
- cardOne = 6;
- }
- if (arr[0] == "7")
- {
- cardOne = 5;
- }
- if (arr[0] == "8")
- {
- cardOne = 4;
- }
- if (arr[0] == "9")
- {
- cardOne = 3;
- }
- if (arr[0] == "10")
- {
- cardOne = 2;
- }
- if (arr[0] == "A")
- {
- cardOne = 1;
- }
- if (arr[0] == "J")
- {
- cardOne = 11;
- }
- if (arr[0] == "Q")
- {
- cardOne = 12;
- }
- if (arr[0] == "K")
- {
- cardOne = 13;
- }
- if (arr[0] == "X")
- {
- xCounter1++;
- temp = 0;
- }
- if (arr[0] == "Y")
- {
- scorePlayerOne = scorePlayerOne - 200;
- temp = 0;
- }
- if (arr[0] == "Z")
- {
- scorePlayerOne = scorePlayerOne * 2;
- temp = 0;
- }
- if (arr[1] == "2")
- {
- cardTwo = 10;
- }
- if (arr[1] == "3")
- {
- cardTwo = 9;
- }
- if (arr[1] == "4")
- {
- cardTwo = 8;
- }
- if (arr[1] == "5")
- {
- cardTwo = 7;
- }
- if (arr[1] == "6")
- {
- cardTwo = 6;
- }
- if (arr[1] == "7")
- {
- cardTwo = 5;
- }
- if (arr[1] == "8")
- {
- cardTwo = 4;
- }
- if (arr[1] == "9")
- {
- cardTwo = 3;
- }
- if (arr[1] == "10")
- {
- cardTwo = 2;
- }
- if (arr[1] == "A")
- {
- cardTwo = 1;
- }
- if (arr[1] == "J")
- {
- cardTwo = 11;
- }
- if (arr[1] == "Q")
- {
- cardTwo = 12;
- }
- if (arr[1] == "K")
- {
- cardTwo = 13;
- }
- if (arr[1] == "X")
- {
- xCounter1++;
- temp = 0;
- }
- if (arr[1] == "Y")
- {
- scorePlayerOne = scorePlayerOne - 200;
- temp = 0;
- }
- if (arr[1] == "Z")
- {
- scorePlayerOne = scorePlayerOne * 2;
- temp = 0;
- }
- if (arr[2] == "2")
- {
- cardThree = 10;
- }
- if (arr[2] == "3")
- {
- cardThree = 9;
- }
- if (arr[2] == "4")
- {
- cardThree = 8;
- }
- if (arr[2] == "5")
- {
- cardThree = 7;
- }
- if (arr[2] == "6")
- {
- cardThree = 6;
- }
- if (arr[2] == "7")
- {
- cardThree = 5;
- }
- if (arr[2] == "8")
- {
- cardThree = 4;
- }
- if (arr[2] == "9")
- {
- cardThree = 3;
- }
- if (arr[2] == "10")
- {
- cardThree = 2;
- }
- if (arr[2] == "A")
- {
- cardThree = 1;
- }
- if (arr[2] == "J")
- {
- cardThree = 11;
- }
- if (arr[2] == "Q")
- {
- cardThree = 12;
- }
- if (arr[2] == "K")
- {
- cardThree = 13;
- }
- if (arr[2] == "X")
- {
- xCounter1++;
- temp = 0;
- }
- if (arr[2] == "Y")
- {
- scorePlayerOne = scorePlayerOne - 200;
- temp = 0;
- }
- if (arr[2] == "Z")
- {
- scorePlayerOne = scorePlayerOne * 2;
- temp = 0;
- }
- int sum = cardOne + cardTwo + cardThree;
- temp = sum;
- cardOne = 0;
- cardTwo = 0;
- cardThree = 0;
- sum = 0;
- string[] arr1 = new string[3];
- arr1[0] = Console.ReadLine();
- arr1[1] = Console.ReadLine();
- arr1[2] = Console.ReadLine();
- if (arr1[0] == "2")
- {
- cardOne = 10;
- }
- if (arr1[0] == "3")
- {
- cardOne = 9;
- }
- if (arr1[0] == "4")
- {
- cardOne = 8;
- }
- if (arr1[0] == "5")
- {
- cardOne = 7;
- }
- if (arr1[0] == "6")
- {
- cardOne = 6;
- }
- if (arr1[0] == "7")
- {
- cardOne = 5;
- }
- if (arr1[0] == "8")
- {
- cardOne = 4;
- }
- if (arr1[0] == "9")
- {
- cardOne = 3;
- }
- if (arr1[0] == "10")
- {
- cardOne = 2;
- }
- if (arr1[0] == "A")
- {
- cardOne = 1;
- }
- if (arr1[0] == "J")
- {
- cardOne = 11;
- }
- if (arr1[0] == "Q")
- {
- cardOne = 12;
- }
- if (arr1[0] == "K")
- {
- cardOne = 13;
- }
- if (arr1[0] == "X")
- {
- xCounter2++;
- temp1 = 0;
- }
- if (arr1[0] == "Y")
- {
- scorePlayerTwo = scorePlayerTwo - 200;
- temp1 = 0;
- }
- if (arr1[0] == "Z")
- {
- scorePlayerTwo = scorePlayerTwo * 2;
- temp1 = 0;
- }
- if (arr1[1] == "2")
- {
- cardTwo = 10;
- }
- if (arr1[1] == "3")
- {
- cardTwo = 9;
- }
- if (arr1[1] == "4")
- {
- cardTwo = 8;
- }
- if (arr1[1] == "5")
- {
- cardTwo = 7;
- }
- if (arr1[1] == "6")
- {
- cardTwo = 6;
- }
- if (arr1[1] == "7")
- {
- cardTwo = 5;
- }
- if (arr1[1] == "8")
- {
- cardTwo = 4;
- }
- if (arr1[1] == "9")
- {
- cardTwo = 3;
- }
- if (arr1[1] == "10")
- {
- cardTwo = 2;
- }
- if (arr1[1] == "A")
- {
- cardTwo = 1;
- }
- if (arr1[1] == "J")
- {
- cardTwo = 11;
- }
- if (arr1[1] == "Q")
- {
- cardTwo = 12;
- }
- if (arr1[1] == "K")
- {
- cardTwo = 13;
- }
- if (arr1[1] == "X")
- {
- xCounter2++;
- temp1 = 0;
- }
- if (arr1[1] == "Y")
- {
- scorePlayerTwo = scorePlayerTwo - 200;
- temp1 = 0;
- }
- if (arr1[1] == "Z")
- {
- scorePlayerTwo = scorePlayerTwo * 2;
- temp1 = 0;
- }
- if (arr1[2] == "2")
- {
- cardThree = 10;
- }
- if (arr1[2] == "3")
- {
- cardThree = 9;
- }
- if (arr1[2] == "4")
- {
- cardThree = 8;
- }
- if (arr1[2] == "5")
- {
- cardThree = 7;
- }
- if (arr1[2] == "6")
- {
- cardThree = 6;
- }
- if (arr1[2] == "7")
- {
- cardThree = 5;
- }
- if (arr1[2] == "8")
- {
- cardThree = 4;
- }
- if (arr1[2] == "9")
- {
- cardThree = 3;
- }
- if (arr1[2] == "10")
- {
- cardThree = 2;
- }
- if (arr1[2] == "A")
- {
- cardThree = 1;
- }
- if (arr1[2] == "J")
- {
- cardThree = 11;
- }
- if (arr1[2] == "Q")
- {
- cardThree = 12;
- }
- if (arr1[2] == "K")
- {
- cardThree = 13;
- }
- if (arr1[2] == "X")
- {
- xCounter2++;
- temp1 = 0;
- }
- if (arr1[2] == "Y")
- {
- scorePlayerTwo = scorePlayerTwo - 200;
- temp1 = 0;
- }
- if (arr1[2] == "Z")
- {
- scorePlayerTwo = scorePlayerTwo * 2;
- temp1 = 0;
- }
- sum = cardOne + cardTwo + cardThree;
- temp1 = sum;
- sum = 0;
- if ((xCounter1 > 0) && (xCounter2 == 0))
- {
- Console.Write("X card drawn! ");
- Console.Write("Player one wins the match!");
- scorePlayerOne = -1;
- return;
- }
- if ((xCounter2 > 0) && (xCounter1 == 0))
- {
- Console.Write("X card drawn! ");
- Console.Write("Player two wins the match!");
- scorePlayerTwo = -1;
- return;
- }
- if ((xCounter1 != 0) && (xCounter2 != 0))
- {
- scorePlayerOne = scorePlayerOne + 50;
- scorePlayerTwo = scorePlayerTwo + 50;
- }
- if (temp > temp1)
- {
- gamesWon1++;
- scorePlayerOne = scorePlayerOne + temp;
- }
- if (temp < temp1)
- {
- gamesWon2++;
- scorePlayerTwo = scorePlayerTwo + temp1;
- }
- if (temp == temp1)
- {
- continue;
- }
- }
- //if ((scorePlayerOne | scorePlayerTwo) < 0)
- //{
- // return;
- //}
- if (scorePlayerOne > scorePlayerTwo)
- {
- Console.WriteLine("First player wins!");
- Console.WriteLine("Score: {0}", scorePlayerOne);
- Console.Write("Games won: {0}", gamesWon1);
- }
- if (scorePlayerTwo > scorePlayerOne)
- {
- Console.WriteLine("Second player wins!");
- Console.WriteLine("Score: {0}", scorePlayerTwo);
- Console.Write("Games won: {0}", gamesWon2);
- }
- if (scorePlayerOne == scorePlayerTwo)
- {
- Console.WriteLine("It's a tie!");
- Console.Write("Score: {0}", scorePlayerOne);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment