Advertisement
LachoTodorov

Untitled

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