Advertisement
Guest User

15.NeighbourWars

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