public static void Main()
Terrorist terrorist = new Terrorist("Killer", 20, true);
CounterTerrorist counterTerrorist = new CounterTerrorist("KKK", 50);
terrorist.PrintPlayersData();
terrorist.Shoot(counterTerrorist);
counterTerrorist.PrintPlayersData();
counterTerrorist.DefuseABomb();
counterTerrorist.Shoot(terrorist);
terrorist.PrintPlayersData();
public class Terrorist : PlayersData
public Terrorist(string nickname, int health, bool carryBomb)
:base(nickname, health, carryBomb)
this.nickname = nickname;
this.carryBomb = carryBomb;
public void Shoot(PlayersData player)
Console.WriteLine("{2} the {3} is shooting at {0} the {1}", player.nickname, player.GetType().Name, this.nickname, this.GetType().Name);
if (player.isAlive && player.health >= 40)
else if (player.health == 20)
Console.WriteLine("{0} the {2} killed {1} the {3}", this.nickname, player.nickname, this.GetType().Name, player.GetType().Name);
public override void PrintPlayersData()
Console.WriteLine("Terrorit name: {0}, health: {1}. Terorist is {2}",
this.nickname, this.health, this.isAlive == true ? "alive" : "dead");
Console.WriteLine("{0} plant the bomb", this.nickname);
else Console.WriteLine();
public class CounterTerrorist : PlayersData
public CounterTerrorist(string nickname, int health)
this.nickname = nickname;
public void Shoot(PlayersData player)
Console.WriteLine("{2} the {3} is shooting at {0} the {1}", player.nickname, player.GetType().Name, this.nickname, this.GetType().Name);
if (player.isAlive && player.health >= 40)
else if (player.health == 20)
Console.WriteLine("{0} the {2} killed {1} the {3}", this.nickname, player.nickname, this.GetType().Name, player.GetType().Name);
public void DefuseABomb()
Console.WriteLine("{0} defused the bomb", this.nickname);
else Console.WriteLine();
public override void PrintPlayersData()
Console.WriteLine("Counter-Terrorist name: {0}, health: {1}. Counter-Terrorist is {2}",
this.nickname, this.health, this.isAlive == true ? "alive" : "dead");
public class Hostages : PlayersData
public Hostages(int health)
public override void PrintPlayersData()
Console.WriteLine("Hostages' health is {0}. Hostage is {1}",
this.health, this.isAlive == true ? "alive" : "dead");
public interface ICanShoot
void Shoot(PlayersData player);
public abstract class PlayersData
public PlayersData(string nickname, int health, bool carryBomb)
this.nickname = nickname;
this.carryBomb = carryBomb;
public PlayersData(string nickname, int health)
this.nickname = nickname;
public PlayersData(int health)
public abstract void PrintPlayersData();