VelizarAvramov

15. Neighbour Wars

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