Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace GameNumberWars
- {
- class Program
- {
- static void Main(string[] args)
- {
- string playerOneName = Console.ReadLine();
- string playerTwoName = Console.ReadLine();
- int playerOnePoints = 0;
- int playerTwoPoints = 0;
- while (true)
- {
- string commands = Console.ReadLine();
- if (commands.Equals("End of game"))
- {
- Console.WriteLine($"{playerOneName} has {playerOnePoints} points");
- Console.WriteLine($"{playerTwoName} has {playerTwoPoints} points");
- break;
- }
- int cardPlayerOne = int.Parse(commands);
- int cardPlayerTwo = int.Parse(Console.ReadLine());
- if (cardPlayerOne.Equals(cardPlayerTwo))
- {
- Console.WriteLine("Number wars!");
- int numberWarsCardOne = int.Parse(Console.ReadLine());
- int numbersWarsCardTwo = int.Parse(Console.ReadLine());
- if (numbersWarsCardTwo > numberWarsCardOne)
- {
- Console.WriteLine($"{playerTwoName} is winner with {playerTwoPoints} points");
- }
- else
- {
- Console.WriteLine($"{playerOneName} is winner with {playerOnePoints} points");
- }
- break;
- }
- else if (cardPlayerOne > cardPlayerTwo)
- {
- playerOnePoints += cardPlayerOne - cardPlayerTwo;
- }
- else
- {
- playerTwoPoints += cardPlayerTwo - cardPlayerOne;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement