Commits

Alexander Regueiro  committed 517c380

Fixed another bug in FinalBot.

  • Participants
  • Parent commits 81dadb2

Comments (0)

Files changed (1)

File src/Bots/Icfp2011.Icrs.FinalBot/FinalBot.cs

 
 namespace Icfp2011.Icrs.Bots
 {
+    using System.Diagnostics;
     using Bot;
 
     public class FinalBot : LtgBot
 
         public override LtgAction DoAction()
         {
-            // Run active actions.
-            var removeActions = new LinkedList<LtgRoutine>();
-            foreach (var routine in this.activeRoutines)
-            {
-                var action = routine.GetNextAction();
-                if (action == null)
-                {
-                    removeActions.AddLast(routine);
-                    break;
-                }
-                return action.Value;
-            }
-            foreach (var routine in removeActions)
-                this.activeRoutines.Remove(routine);
-
             if (!this.IsRoutineRunning)
             {
-                if (this.Match.TurnNumber == 0)
+                if (this.Match.TurnNumber == 1)
                 {
                     StartRoutine(routineQuickAttack);
                     StartRoutine(routineSuperRevive);
                 }
             }
 
+            // Run active actions.
+            var removeActions = new LinkedList<LtgRoutine>();
+            foreach (var routine in this.activeRoutines)
+            {
+                var action = routine.GetNextAction();
+                if (action == null)
+                {
+                    removeActions.AddLast(routine);
+                    continue;
+                }
+                return action.Value;
+            }
+            foreach (var routine in removeActions)
+                this.activeRoutines.Remove(routine);
+
+            Debug.Fail("Default action.");
             return defaultAction;
         }