Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CardWarsBatka
- {
- static void Main()
- {
- int numberOfGames = int.Parse(Console.ReadLine());
- string[] cards = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "A", "J", "Q", "K"};
- int firstPlayerScore = 0;
- int secondPlayerScore = 0;
- int firstPlayerWon = 0;
- int secondPlayerWon = 0;
- for (int i = 1; i <= numberOfGames; i++)
- {
- int currentFirstPlayerScore = 0;
- int currentSecondPlayerScore = 0;
- int firstPlayerCounterForZCard = 0;
- int secondPlayerCounterForZCard = 0;
- int firstPlayerCounterForYCard = 0;
- int secondPlayerCounterForYCard = 0;
- int firstPlayerCounterForXCard = 0;
- int secondPlayerCounterForXCard = 0;
- string firstPlayerFirstCard = (Console.ReadLine());
- string firstPlayerSecondCard = (Console.ReadLine());
- string firstPlayerThirdCard = (Console.ReadLine());
- string SecondPlayerFirstCard = (Console.ReadLine());
- string SecondPlayerSecondCard = (Console.ReadLine());
- string SecondPlayerThirdCard = (Console.ReadLine());
- if (firstPlayerFirstCard == "2")
- {
- currentFirstPlayerScore += 10;
- }
- if (firstPlayerFirstCard == "3")
- {
- currentFirstPlayerScore += 9;
- }
- if (firstPlayerFirstCard == "4")
- {
- currentFirstPlayerScore += 8;
- }
- if (firstPlayerFirstCard == "5")
- {
- currentFirstPlayerScore += 7;
- }
- if (firstPlayerFirstCard == "6")
- {
- currentFirstPlayerScore += 6;
- }
- if (firstPlayerFirstCard == "7")
- {
- currentFirstPlayerScore += 5;
- }
- if (firstPlayerFirstCard == "8")
- {
- currentFirstPlayerScore += 4;
- }
- if (firstPlayerFirstCard == "9")
- {
- currentFirstPlayerScore += 3;
- }
- if (firstPlayerFirstCard == "10")
- {
- currentFirstPlayerScore += 2;
- }
- if (firstPlayerFirstCard == "A")
- {
- currentFirstPlayerScore += 1;
- }
- if (firstPlayerFirstCard == "J")
- {
- currentFirstPlayerScore += 11;
- }
- if (firstPlayerFirstCard == "Q")
- {
- currentFirstPlayerScore += 12;
- }
- if (firstPlayerFirstCard == "K")
- {
- currentFirstPlayerScore += 13;
- }
- if (firstPlayerFirstCard == "Z")
- {
- firstPlayerCounterForZCard++;
- }
- if (firstPlayerFirstCard == "Y")
- {
- firstPlayerCounterForYCard++;
- }
- if (firstPlayerFirstCard == "X")
- {
- firstPlayerCounterForXCard++;
- }
- // second
- if (firstPlayerSecondCard == "2")
- {
- currentFirstPlayerScore += 10;
- }
- if (firstPlayerSecondCard == "3")
- {
- currentFirstPlayerScore += 9;
- }
- if (firstPlayerSecondCard == "4")
- {
- currentFirstPlayerScore += 8;
- }
- if (firstPlayerSecondCard == "5")
- {
- currentFirstPlayerScore += 7;
- }
- if (firstPlayerSecondCard == "6")
- {
- currentFirstPlayerScore += 6;
- }
- if (firstPlayerSecondCard == "7")
- {
- currentFirstPlayerScore += 5;
- }
- if (firstPlayerSecondCard == "8")
- {
- currentFirstPlayerScore += 4;
- }
- if (firstPlayerSecondCard == "9")
- {
- currentFirstPlayerScore += 3;
- }
- if (firstPlayerSecondCard == "10")
- {
- currentFirstPlayerScore += 2;
- }
- if (firstPlayerSecondCard == "A")
- {
- currentFirstPlayerScore += 1;
- }
- if (firstPlayerSecondCard == "J")
- {
- currentFirstPlayerScore += 11;
- }
- if (firstPlayerSecondCard == "Q")
- {
- currentFirstPlayerScore += 12;
- }
- if (firstPlayerSecondCard == "K")
- {
- currentFirstPlayerScore += 13;
- }
- if (firstPlayerSecondCard == "Z")
- {
- firstPlayerCounterForZCard++;
- }
- if (firstPlayerSecondCard == "Y")
- {
- firstPlayerCounterForYCard++;
- }
- if (firstPlayerSecondCard == "X")
- {
- firstPlayerCounterForXCard++;
- }
- // third
- if (firstPlayerThirdCard == "2")
- {
- currentFirstPlayerScore += 10;
- }
- if (firstPlayerThirdCard == "3")
- {
- currentFirstPlayerScore += 9;
- }
- if (firstPlayerThirdCard == "4")
- {
- currentFirstPlayerScore += 8;
- }
- if (firstPlayerThirdCard == "5")
- {
- currentFirstPlayerScore += 7;
- }
- if (firstPlayerThirdCard == "6")
- {
- currentFirstPlayerScore += 6;
- }
- if (firstPlayerThirdCard == "7")
- {
- currentFirstPlayerScore += 5;
- }
- if (firstPlayerThirdCard == "8")
- {
- currentFirstPlayerScore += 4;
- }
- if (firstPlayerThirdCard == "9")
- {
- currentFirstPlayerScore += 3;
- }
- if (firstPlayerThirdCard == "10")
- {
- currentFirstPlayerScore += 2;
- }
- if (firstPlayerThirdCard == "A")
- {
- currentFirstPlayerScore += 1;
- }
- if (firstPlayerThirdCard == "J")
- {
- currentFirstPlayerScore += 11;
- }
- if (firstPlayerThirdCard == "Q")
- {
- currentFirstPlayerScore += 12;
- }
- if (firstPlayerThirdCard == "K")
- {
- currentFirstPlayerScore += 13;
- }
- if (firstPlayerThirdCard == "Z")
- {
- firstPlayerCounterForZCard++;
- }
- if (firstPlayerThirdCard == "Y")
- {
- firstPlayerCounterForYCard++;
- }
- if (firstPlayerThirdCard == "X")
- {
- firstPlayerCounterForXCard++;
- }
- // second player first hand
- if (SecondPlayerFirstCard == "2")
- {
- currentSecondPlayerScore += 10;
- }
- if (SecondPlayerFirstCard == "3")
- {
- currentSecondPlayerScore += 9;
- }
- if (SecondPlayerFirstCard == "4")
- {
- currentSecondPlayerScore += 8;
- }
- if (SecondPlayerFirstCard == "5")
- {
- currentSecondPlayerScore += 7;
- }
- if (SecondPlayerFirstCard == "6")
- {
- currentSecondPlayerScore += 6;
- }
- if (SecondPlayerFirstCard == "7")
- {
- currentSecondPlayerScore += 5;
- }
- if (SecondPlayerFirstCard == "8")
- {
- currentSecondPlayerScore += 4;
- }
- if (SecondPlayerFirstCard == "9")
- {
- currentSecondPlayerScore += 3;
- }
- if (SecondPlayerFirstCard == "10")
- {
- currentSecondPlayerScore += 2;
- }
- if (SecondPlayerFirstCard == "A")
- {
- currentSecondPlayerScore += 1;
- }
- if (SecondPlayerFirstCard == "J")
- {
- currentSecondPlayerScore += 11;
- }
- if (SecondPlayerFirstCard == "Q")
- {
- currentSecondPlayerScore += 12;
- }
- if (SecondPlayerFirstCard == "K")
- {
- currentSecondPlayerScore += 13;
- }
- if (SecondPlayerFirstCard == "Z")
- {
- secondPlayerCounterForZCard++;
- }
- if (SecondPlayerFirstCard == "Y")
- {
- secondPlayerCounterForYCard++;
- }
- if (SecondPlayerFirstCard == "X")
- {
- secondPlayerCounterForXCard++;
- }
- // seconod player second hand
- if (SecondPlayerSecondCard == "2")
- {
- currentSecondPlayerScore += 10;
- }
- if (SecondPlayerSecondCard == "3")
- {
- currentSecondPlayerScore += 9;
- }
- if (SecondPlayerSecondCard == "4")
- {
- currentSecondPlayerScore += 8;
- }
- if (SecondPlayerSecondCard == "5")
- {
- currentSecondPlayerScore += 7;
- }
- if (SecondPlayerSecondCard == "6")
- {
- currentSecondPlayerScore += 6;
- }
- if (SecondPlayerSecondCard == "7")
- {
- currentSecondPlayerScore += 5;
- }
- if (SecondPlayerSecondCard == "8")
- {
- currentSecondPlayerScore += 4;
- }
- if (SecondPlayerSecondCard == "9")
- {
- currentSecondPlayerScore += 3;
- }
- if (SecondPlayerSecondCard == "10")
- {
- currentSecondPlayerScore += 2;
- }
- if (SecondPlayerSecondCard == "A")
- {
- currentSecondPlayerScore += 1;
- }
- if (SecondPlayerSecondCard == "J")
- {
- currentSecondPlayerScore += 11;
- }
- if (SecondPlayerSecondCard == "Q")
- {
- currentSecondPlayerScore += 12;
- }
- if (SecondPlayerSecondCard == "K")
- {
- currentSecondPlayerScore += 13;
- }
- if (SecondPlayerSecondCard == "Z")
- {
- secondPlayerCounterForZCard++;
- }
- if (SecondPlayerSecondCard == "Y")
- {
- secondPlayerCounterForYCard++;
- }
- if (SecondPlayerSecondCard == "X")
- {
- secondPlayerCounterForXCard++;
- }
- // second player third hand
- if (SecondPlayerThirdCard == "2")
- {
- currentSecondPlayerScore += 10;
- }
- if (SecondPlayerThirdCard == "3")
- {
- currentSecondPlayerScore += 9;
- }
- if (SecondPlayerThirdCard == "4")
- {
- currentSecondPlayerScore += 8;
- }
- if (SecondPlayerThirdCard == "5")
- {
- currentSecondPlayerScore += 7;
- }
- if (SecondPlayerThirdCard == "6")
- {
- currentSecondPlayerScore += 6;
- }
- if (SecondPlayerThirdCard == "7")
- {
- currentSecondPlayerScore += 5;
- }
- if (SecondPlayerThirdCard == "8")
- {
- currentSecondPlayerScore += 4;
- }
- if (SecondPlayerThirdCard == "9")
- {
- currentSecondPlayerScore += 3;
- }
- if (SecondPlayerThirdCard == "10")
- {
- currentSecondPlayerScore += 2;
- }
- if (SecondPlayerThirdCard == "A")
- {
- currentSecondPlayerScore += 1;
- }
- if (SecondPlayerThirdCard == "J")
- {
- currentSecondPlayerScore += 11;
- }
- if (SecondPlayerThirdCard == "Q")
- {
- currentSecondPlayerScore += 12;
- }
- if (SecondPlayerThirdCard == "K")
- {
- currentSecondPlayerScore += 13;
- }
- if (SecondPlayerThirdCard == "Z")
- {
- secondPlayerCounterForZCard++;
- }
- if (SecondPlayerThirdCard == "Y")
- {
- secondPlayerCounterForYCard++;
- }
- if (SecondPlayerThirdCard == "X")
- {
- secondPlayerCounterForXCard++;
- }
- for (int c = 0; c < firstPlayerCounterForYCard; c++)
- {
- firstPlayerScore -= 200;
- }
- for (int c = 0; c < firstPlayerCounterForZCard; c++)
- {
- firstPlayerScore *= 2;
- }
- for (int c = 0; c < secondPlayerCounterForYCard; c++)
- {
- secondPlayerScore -= 200;
- }
- for (int c = 0; c < secondPlayerCounterForZCard; c++)
- {
- secondPlayerScore *= 2;
- }
- if (currentFirstPlayerScore == currentSecondPlayerScore)
- {
- currentFirstPlayerScore = 0;
- currentSecondPlayerScore = 0;
- }
- else if (currentFirstPlayerScore > currentSecondPlayerScore)
- {
- firstPlayerScore += currentFirstPlayerScore;
- }
- else if (currentSecondPlayerScore > currentFirstPlayerScore)
- {
- secondPlayerScore += currentSecondPlayerScore;
- }
- if (secondPlayerCounterForXCard > 0 || firstPlayerCounterForXCard > 0)
- {
- if (firstPlayerCounterForXCard > secondPlayerCounterForXCard)
- {
- Console.WriteLine("X card drawn! Player one wins the match!");
- return;
- }
- else if (secondPlayerCounterForXCard > firstPlayerCounterForXCard)
- {
- Console.WriteLine("X card drawn! Player two wins the match!");
- return;
- }
- else if (secondPlayerCounterForXCard == firstPlayerCounterForXCard)
- {
- for (int C = 0; C < firstPlayerCounterForXCard; C++)
- {
- firstPlayerScore += 50;
- secondPlayerScore += 50;
- }
- }
- }
- if (currentFirstPlayerScore > currentSecondPlayerScore)
- {
- firstPlayerWon++;
- }
- else if (currentSecondPlayerScore > currentFirstPlayerScore)
- {
- secondPlayerWon++;
- }
- }
- if (firstPlayerScore > secondPlayerScore)
- {
- Console.WriteLine("First player wins!");
- Console.WriteLine("Score: {0}", firstPlayerScore);
- Console.WriteLine("Games won: {0}", firstPlayerWon);
- }
- else if (secondPlayerScore > firstPlayerScore)
- {
- Console.WriteLine("Second player wins!");
- Console.WriteLine("Score: {0}", secondPlayerScore);
- Console.WriteLine("Games won: {0}", secondPlayerWon);
- }
- else
- {
- Console.WriteLine("It's a tie!");
- Console.WriteLine("Score: {0}", firstPlayerScore);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement