Britbot
static Britbot.Commander.Commander ( ) [inline, static, private]

This static constructor will run once and initialize the commander.

Definition at line 49 of file Commander.cs.

        {
            Groups = new List<Group>();
            _turnTimer = new Stopwatch();
            _deadPirates = new List<int>();

            #region Terrible Switch-Case

            //TODO initial config should be better then this
            //Hookup the UltimateConfig() here

            if (Bot.Game.Islands().Count == 1)
            {
                Groups.Add(new Group(0, Bot.Game.AllMyPirates().Count));
                return;
            }

            //TODO this is awfully specific for the game bots. We have to generalize this
            switch (Bot.Game.AllMyPirates().Count)
            {
                case 3:
                    Groups.Add(new Group(0, 2));
                    Groups.Add(new Group(2, 1));
                    break;
                case 4:
                    if (Bot.Game.AllEnemyPirates().Count > 4)
                    {
                        Groups.Add(new Group(0, 1));
                        Groups.Add(new Group(1, 1));
                        Groups.Add(new Group(2, 2));
                    }
                    else
                    {
                        Groups.Add(new Group(0, 3));
                        Groups.Add(new Group(3, 1));
                        ;
                    }
                    break;
                case 5:
                    Groups.Add(new Group(0, 2));
                    Groups.Add(new Group(2, 2));
                    Groups.Add(new Group(4, 1));
                    break;
                case 6:
                    if (Bot.Game.EnemyIslands().Count > 0)
                    {
                        Groups.Add(new Group(0, 5));
                        Groups.Add(new Group(5, 1));
                    }
                    else
                    {
                        Groups.Add(new Group(2, 4));
                        Groups.Add(new Group(0, 1));
                        Groups.Add(new Group(1, 1));
                    }
                    break;
                case 7:
                    Groups.Add(new Group(0, 2));
                    Groups.Add(new Group(2, 3));
                    Groups.Add(new Group(5, 2));

                    break;
                case 8:
                    if (Bot.Game.GetMyPirate(7).Loc.Row == 39)
                    {
                        Groups.Add(new Group(0, 4));
                        Groups.Add(new Group(4, 3));
                        Groups.Add(new Group(7, 1));
                    }
                    else
                    {
                        Groups.Add(new Group(0, 3));
                        Groups.Add(new Group(3, 2));
                        Groups.Add(new Group(5, 2));
                        Groups.Add(new Group(7, 1));
                    }
                    break;
                case 9:
                    Groups.Add(new Group(0, 3));
                    Groups.Add(new Group(3, 3));
                    Groups.Add(new Group(6, 2));
                    Groups.Add(new Group(8, 1));
                    break;
                default:
                    for (int i = 0; i < Bot.Game.AllMyPirates().Count; i++)
                        Groups.Add(new Group(i, 1));
                    break;
            }

            #endregion
        }