예제 #1
0
        static void Main(string[] args)
        {
            Castle castleA = new Castle(4);
            Castle castleB = new Castle(2);

            while (!castleA.IsDefeated && !castleB.IsDefeated)
            {
                Console.WriteLine("Castle A:");
                castleA.PrintResidents();
                Console.WriteLine(new String('-', 30));
                Console.WriteLine("Castle B:");
                castleB.PrintResidents();
                Console.WriteLine(new String('=', 30));
                castleA.WageWar(castleB);
                castleB.WageWar(castleA);
            }
        }
예제 #2
0
 public void WageWar(Castle other)
 {
     foreach (Character chr in _chars)
     {
         Character defender = other.Defender;
         if (defender != null)
         {
             chr.Fight(defender);
         }
         else
         {
             return;
         }
     }
     other.CleanUp();
     CleanUp();
 }