VelizarAvramov

15. Neighbour Wars

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