|
Britbot
|
00001 #region #Usings 00002 00003 using System.Collections.Generic; 00004 using Pirates; 00005 00006 #endregion 00007 00008 namespace Britbot 00009 { 00013 internal static class Mover 00014 { 00019 public static void MoveAll(Dictionary<Pirate, Direction> moves) 00020 { 00021 //Logger.BeginTime("MoveAll"); 00022 try 00023 { 00024 //iterate over all moves and execute them 00025 foreach (KeyValuePair<Pirate, Direction> move in moves) 00026 { 00027 if (!move.Key.IsLost) 00028 Bot.Game.SetSail(move.Key, move.Value); 00029 } 00030 } 00031 catch 00032 { 00033 //don't move anything if we crash, but this will save us from timeout 00034 foreach (Pirate p in Bot.Game.AllMyPirates()) 00035 { 00036 if (!p.IsLost) 00037 Bot.Game.SetSail(p, Direction.NOTHING); 00038 } 00039 } 00040 //Logger.StopTime("MoveAll"); 00041 } 00042 } 00043 }
1.7.6.1