Advertisement
YavorGrancharov

Neighbour_Wars

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