simeon3000

Neighbour Wars

May 28th, 2017
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1.  
  2.             int peshoDamage = int.Parse(Console.ReadLine());
  3.             int goshoDamage = int.Parse(Console.ReadLine());
  4.  
  5.             int peshoHealth = 100;
  6.             int goshoHealth = 100;
  7.             int counter = 0;
  8.  
  9.             for (int i = 1; ; i++)
  10.             {
  11.                 counter++;
  12.  
  13.                 if (i % 2 != 0)
  14.                 {
  15.                     goshoHealth -= peshoDamage;
  16.  
  17.                     if (goshoHealth > 0)
  18.                     {
  19.                         Console.WriteLine($"Pesho used Roundhouse kick and reduced Gosho to {goshoHealth} health.");
  20.                     }
  21.                 }
  22.                 else
  23.                 {
  24.                     peshoHealth -= goshoDamage;
  25.  
  26.                     if (peshoHealth > 0)
  27.                     {
  28.                         Console.WriteLine($"Gosho used Thunderous fist and reduced Pesho to {peshoHealth} health.");
  29.                     }
  30.                 }
  31.  
  32.                 if (peshoHealth <= 0 || goshoHealth <= 0) break;
  33.  
  34.                 if (i % 3 == 0)
  35.                 {
  36.                     peshoHealth += 10;
  37.                     goshoHealth += 10;
  38.                 }
  39.             }
  40.  
  41.             string winner = (peshoHealth > goshoHealth) ? "Pesho" : "Gosho";
  42.  
  43.             Console.WriteLine($"{winner} won in {counter}th round.");
Advertisement
Add Comment
Please, Sign In to add comment