예제 #1
0
        protected override int Part1(string[] input)
        {
            var combat = new Combat(input, 3);

            while (!combat.Completed)
            {
                combat.BattleRound();
            }
            return(combat.Outcome);
        }
예제 #2
0
 protected override int Part2(string[] input)
 {
     for (var attack = 4;; attack++)
     {
         var combat = new Combat(input, attack);
         while (!combat.Completed && combat.AllElfsSurvived)
         {
             combat.BattleRound();
         }
         if (combat.AllElfsSurvived)
         {
             return(combat.Outcome);
         }
     }
 }