Advertisement
Guest User

NeighbourWars

a guest
Sep 26th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _15.NeighbourWars
  4. {
  5.     class NeighbourWars
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var peshoDamage = int.Parse(Console.ReadLine());
  10.             var goshoDamage = int.Parse(Console.ReadLine());
  11.  
  12.             var peshoHealth = 100;
  13.             var goshoHealth = 100;
  14.             var round = 1;
  15.  
  16.             while (true)
  17.             {
  18.                
  19.                 if (round % 2 != 0)
  20.                 {
  21.                     goshoHealth -= peshoDamage;
  22.                     if (goshoHealth <= 0)
  23.                     {
  24.                         break;
  25.                     }
  26.                     Console.WriteLine($"Pesho used Roundhouse kick and reduced Gosho to {goshoHealth} health.");
  27.                    
  28.                 }
  29.                 else
  30.                 {
  31.                     peshoHealth -= goshoDamage;
  32.                     if (peshoHealth <= 0)
  33.                     {
  34.                         break;
  35.                     }
  36.                     Console.WriteLine($"Gosho used Thunderous fist and reduced Pesho to {peshoHealth} health.");
  37.                 }
  38.                 if (round % 3 == 0)
  39.                 {
  40.                     goshoHealth += 10;
  41.                     peshoHealth += 10;
  42.                 }
  43.                 round++;
  44.             }
  45.             if (peshoHealth > goshoHealth)
  46.             {
  47.                 Console.WriteLine($"Pesho won in {round}th round.");
  48.             }
  49.             else
  50.             {
  51.                 Console.WriteLine($"Gosho won in {round}th round.");
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement