Commits

Alexander Regueiro committed 8d7cab9

Final bot updated. Final entry for contest.

  • Participants
  • Parent commits d978a22

Comments (0)

Files changed (9)

 
 The authors of the software are listed as follows.
 
- * Harry Eakins
  * Alex Regueiro
  * Oskar Weigl
 Overview
 ========
 
-This is the entry for the Imperial College Robotics team for the ICFP 2011 contest.
+This is the entry for the Imperial College Robotics team for the ICFP 2011
+contest.
 
-TODO
+See AUTHORS file for members of team.
 
 Implementation
 ==============
 
-TODO
+There are three "bot" implementations which the player program can use.
+
+ * EchoBot - echoes back all actions by opponent
+ * RandomBot - echoes random actions constantly
+ * FinalBot - runs routines of actions depending on propnent and opponent state.
 #!/bin/sh
 
-mono --runtime=v2.0.50727 ./bin/Release/Icfp2011.Icrs.Player.exe ./bin/Release/Icfp2011.Icrs.Bots.FinalBot.dll $@
+cd ./bin/
+mono --runtime=v2.0.50727 ./Release/Icfp2011.Icrs.Player.exe ./Release/Icfp2011.Icrs.Bots.FinalBot.dll $@

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

 
     public class FinalBot : LtgBot
     {
+        private const string routinesDirPath = "./Release/Routines/";
+
         private static readonly LtgAction defaultAction = new LtgAction()
             {
                 ApplyOrder = LtgCardApplyOrder.Left,
         private IList<LtgRoutine> activeRoutines;
 
         // Routines
+        private IList<LtgAction> routineQuickAttack;
+        private IList<LtgAction> routineSuperAttack;
+        private IList<LtgAction> routineSuperHeal;
+        private IList<LtgAction> routineSuperRevive;
 
         public FinalBot()
         {
             LoadAllRoutines();
         }
 
-        public bool IsRunning
+        public bool IsRoutineRunning
         {
             get { return this.activeRoutines.Count > 0; }
         }
             foreach (var routine in removeActions)
                 this.activeRoutines.Remove(routine);
 
-            // TODO
+            if (!this.IsRoutineRunning)
+            {
+                if (this.Match.TurnNumber == 0)
+                {
+                    StartRoutine(routineQuickAttack);
+                    StartRoutine(routineSuperRevive);
+                    StartRoutine(routineSuperHeal);
+                }
 
+                var startSlotsDead = !this.propSlots[0].IsAlive || !this.propSlots[1].IsAlive || !this.propSlots[2].IsAlive;
+                var first50MainlyDead = GetAliveSlotCount(this.Player, 0, 50) > 25;
+                var first50AverageHealth = propSlots.Take(50).Average(s => s.Vitality);
+                var nearEndOfGame = this.Match.TurnNumber > LtgMatch.MaxNumTurns - 100;
+
+                if (startSlotsDead || first50MainlyDead || nearEndOfGame)
+                {
+                    return new LtgAction()
+                        {
+                            ApplyOrder = LtgCardApplyOrder.Right,
+                            Card = LtgCards.Zero,
+                            SlotIndex = 129,
+                        };
+                }
+                else if (first50AverageHealth < 1000)
+                {
+                    return new LtgAction()
+                        {
+                            ApplyOrder = LtgCardApplyOrder.Right,
+                            Card = LtgCards.Zero,
+                            SlotIndex = 131,
+                        }; 
+                }
+                else
+                {
+                    StartRoutine(routineSuperAttack);
+                }
+            }
 
             return defaultAction;
         }
 
         private int GetAliveSlotCount(LtgPlayer player)
         {
+            return GetAliveSlotCount(player, 0, this.Match.GetSlots(player).Length);
+        }
+
+        private int GetAliveSlotCount(LtgPlayer player, int startIndex, int endIndex)
+        {
             var count = 0;
             var slots = this.Match.GetSlots(player);
-            for (int i = 0; i < slots.Length; i++)
+            for (int i = startIndex; i < endIndex; i++)
             {
                 if (slots[i].IsAlive)
                     count++;
             return count;
         }
 
-        private int GetSlotSize(LtgSlot slot)
-        {
-            return GetSlotSize(this.Match.Clone(), slot.Clone().Value);
-        }
+        //private int GetSlotSize(LtgSlot slot)
+        //{
+        //    return GetSlotSize(this.Match.Clone(), slot.Clone().Value);
+        //}
 
-        private int GetSlotSize(LtgMatch match, LtgValue val)
-        {
-            var slotSize = 0;
+        //private int GetSlotSize(LtgMatch match, LtgValue val)
+        //{
+        //    var slotSize = 0;
 
-            var testMatch = match;
-            var evaluator = new LtgFunction((depth, propSlots, oppSlots, arg, reverseMode) =>
-            {
-                var func = arg as LtgFunction;
-                slotSize++;
-                if (func != null && func.Arguments != null)
-                {
-                    foreach (var a in func.Arguments)
-                    {
-                        slotSize += GetSlotSize(match, a);
-                    }
-                }
-                return LtgCards.ICombinator;
-            });
+        //    var testMatch = match;
+        //    var evaluator = new LtgFunction((depth, propSlots, oppSlots, arg, reverseMode) =>
+        //    {
+        //        var func = arg as LtgFunction;
+        //        slotSize++;
+        //        if (func != null && func.Arguments != null)
+        //        {
+        //            foreach (var a in func.Arguments)
+        //            {
+        //                slotSize += GetSlotSize(match, a);
+        //            }
+        //        }
+        //        return LtgCards.ICombinator;
+        //    });
 
-            var evalDepth = 0;
-            var success = evaluator.Evaluate(ref evalDepth,
-                testMatch.GetProponentSlots(), testMatch.GetOpponentSlots(), val, false);
-            return slotSize;
-        }
+        //    var evalDepth = 0;
+        //    var success = evaluator.Evaluate(ref evalDepth,
+        //        testMatch.GetProponentSlots(), testMatch.GetOpponentSlots(), val, false);
+        //    return slotSize;
+        //}
 
         private void LoadAllRoutines()
         {
-            // TODO
+            routineQuickAttack = LoadRoutine("QuickAttack.txt");
+            routineSuperAttack = LoadRoutine("SuperAttack.txt");
+            routineSuperHeal = LoadRoutine("SuperHeal.txt");
+            routineSuperRevive = LoadRoutine("SuperRevive.txt");
+        }
+
+        private bool StartRoutine(IList<LtgAction> routine)
+        {
+            return StartRoutine(new LtgRoutine() { Actions = routine });
         }
 
         private bool StartRoutine(LtgRoutine routine)
         {
-            if (this.activeRoutines.Count > 0)
-                return false;
             this.activeRoutines.Add(routine);
-            return true;
+            return this.activeRoutines.Count > 1;
         }
 
         private IList<LtgAction> LoadRoutine(string path)
         {
             var actions = new List<LtgAction>();
-            using (var reader = File.OpenText(path))
+            using (var reader = File.OpenText(Path.Combine(routinesDirPath, path)))
             {
                 while (true)
                 {

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

   </ItemGroup>
   <ItemGroup />
   <ItemGroup>
+    <Content Include="Routines\QuickAttack.txt">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Routines\SuperAttack.txt">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Routines\SuperHeal.txt">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="Routines\SuperRevive.txt">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

File src/Bots/Icfp2011.Icrs.FinalBot/Routines/QuickAttack.txt

+2 zero 1
+1 inc 1
+2 zero 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+2 zero 2
+1 succ 2
+1 succ 2
+1 succ 2
+1 dbl 2
+1 succ 2
+1 dbl 2
+1 succ 2
+1 dbl 2
+1 succ 2
+1 dbl 2
+1 succ 2
+1 dbl 2
+1 dbl 2
+2 zero 0
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2

File src/Bots/Icfp2011.Icrs.FinalBot/Routines/SuperAttack.txt

+2 zero 1
+1 inc 1
+2 zero 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+1 succ 1
+1 dbl 1
+1 dbl 1
+2 zero 137
+1 revive 137
+2 zero 138
+1 succ 138
+1 revive 138
+2 zero 139
+1 succ 139
+1 succ 139
+1 revive 139
+2 zero 140
+1 succ 140
+1 succ 140
+1 succ 140
+1 revive 140
+1 zero 2
+2 zero 2
+1 succ 2
+1 succ 2
+1 dbl 2
+1 succ 2
+1 dbl 2
+1 dbl 2
+1 dbl 2
+1 dbl 2
+1 dbl 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3
+1 succ 0
+1 succ 2
+2 zero 55
+1 revive 55
+2 attack 3
+1 K 3
+1 S 3
+2 get 3
+2 zero 3
+1 K 3
+1 S 3
+2 get 3
+1 K 3
+1 S 3
+2 succ 3
+1 K 3
+1 S 3
+2 succ 3
+2 zero 3