-
Notifications
You must be signed in to change notification settings - Fork 5
/
P15_NeighbourWars.cs
61 lines (54 loc) · 1.82 KB
/
P15_NeighbourWars.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
namespace P15_NeighbourWars
{
class P15_NeighbourWars
{
static void Main(string[] args)
{
int peshosRoundhouseKickDamage = int.Parse(Console.ReadLine());
int goshosThunderousFistDamage = int.Parse(Console.ReadLine());
int peshosHealth = 100;
int goshosHealth = 100;
bool isPeshoAlive = true;
bool isGoshoAlive = true;
int roundsCount = 0;
while (isPeshoAlive && isGoshoAlive)
{
roundsCount++;
if (roundsCount % 2 == 1)
{// Pesho attacs
goshosHealth -= peshosRoundhouseKickDamage;
if (goshosHealth <= 0)
{
isGoshoAlive = false;
continue;
}
Console.WriteLine($"Pesho used Roundhouse kick and reduced Gosho to {goshosHealth} health.");
}
else
{
peshosHealth -= goshosThunderousFistDamage;
if (peshosHealth <= 0)
{
isPeshoAlive = false;
continue;
}
Console.WriteLine($"Gosho used Thunderous fist and reduced Pesho to {peshosHealth} health.");
}
if (roundsCount % 3 == 0)
{
peshosHealth += 10;
goshosHealth += 10;
}
}
if (isPeshoAlive)
{
Console.WriteLine($"Pesho won in {roundsCount}th round.");
}
else
{
Console.WriteLine($"Gosho won in {roundsCount}th round.");
}
}
}
}