private void WBFMSystem_Resize(object sender, EventArgs e)
        {
            ControlInteraction interaction = new ControlInteraction(new ErrorLog().ControlInteraction);

            interaction(new UIBLL().GetSizeData(this));
            ControlInteraction interaction2 = new ControlInteraction(AlgorithmSetting.Singleton().ControlInteraction);

            interaction2(new UIBLL().GetSizeData(this));

            this.PanelLog.Width     = 239 * this.Width / 800;
            this.PanelControl.Width = 241 * this.Width / 800;
        }
Esempio n. 2
0
        /// <summary>
        /// Отображение настроек генетического алгоритма
        /// </summary>
        private void DisplaySetting()
        {
            var displayResult = new DisplayResult(meDisplaySetting);

            displayResult.ClearText();

            foreach (var prop in AlgorithmSetting.GetType().GetProperties())
            {
                var layoutItem = lcSetting.Items.FindByName($"lci{prop.Name}");

                if (layoutItem == null)
                {
                    continue;
                }

                var value = prop.GetValue(AlgorithmSetting);

                displayResult.DisplayNameWithValue(layoutItem.Text, GetValueByType(value));
            }
        }
Esempio n. 3
0
        private void sbFunctionEnter_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsValidated())
                {
                    seFunctionStartValue.BackColor = Color.LightCoral;
                    return;
                }
                else
                {
                    seFunctionStartValue.BackColor = Color.White;
                }

                for (int i = 0; i < chFunction.Series.Count; i++)
                {
                    chFunction.Series[i].Points.Clear();
                }

                for (double i = AlgorithmSetting.FunctionStartValue; i <= AlgorithmSetting.FunctionFinishValue; i += FunctionStep)
                {
                    chFunction.Series[0].Points.Add(new SeriesPoint(i, AlgorithmSetting.CalcFunction(i)));
                }

                ExtremumPoint = GetGlobalExtremumPoint(chFunction, 0);

                AlgorithmSetting.BestSolution = Convert.ToDouble(ExtremumPoint.Argument);
                AlgorithmSetting.BestFitess   = ExtremumPoint.Values[0];

                DisplayExtremumPoint(ExtremumPoint, chFunction, 1);
                AddAxisLabel(chFunction, "X", "Y");
                sbStart.Enabled = true;
                tabControl.TabPages[1].PageEnabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void PicBoxAlgorithmSetting_Click(object sender, EventArgs e)
 {
     AlgorithmSetting.Singleton().ShowDialog();
 }
        internal static AlgorithmSettings DefineSettings()
        {
            var settings = new AlgorithmSettings()
            {
                AlgorithmName           = AttackName,
                AlgorithmDescriptionURL = "https://www.raccoonbot.com/forum/topic/25606-smart-4-fingers-deploy/"
            };

            // Global Settings.
            var debugMode = new AlgorithmSetting("Debug Mode", "When on, Debug Images will be written out for each attack showing what the algorithm is seeing.", 0, SettingType.Global);

            debugMode.PossibleValues.Add(new SettingOption("Off", 0));
            debugMode.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(debugMode);

            var ccFirst = new AlgorithmSetting("CC Deployment", "Deployment of CC", 0, SettingType.Global);

            ccFirst.PossibleValues.Add(new SettingOption("Deploy at Start", 0));
            ccFirst.PossibleValues.Add(new SettingOption("Deploy at End", 1));
            settings.DefineSetting(ccFirst);

            var setCollMines = new AlgorithmSetting("Set Exposed Collecotors & Mines", "turn on and off searching for outside elixir collectors and gold mines.", 1, SettingType.ActiveAndDead);

            setCollMines.PossibleValues.Add(new SettingOption("Off", 0));
            setCollMines.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(setCollMines);

            // Show These ONLY when Set Exposed Collecotors & Mines is on.
            var minDistance = new AlgorithmSetting("Acceptable Target Range", "the maximun numbers of tiles the collectors and drills can be far from red line", 6, SettingType.ActiveAndDead)
            {
                MinValue = 2,
                MaxValue = 10
            };

            minDistance.HideInUiWhen.Add(new SettingOption("Set Exposed Collecotors & Mines", 0));
            settings.DefineSetting(minDistance);

            var minimElixir = new AlgorithmSetting("Minimum Exposed Colloctors", "Minimum Elixir Colloctores found outside before attack", 3, SettingType.ActiveAndDead)
            {
                MinValue = 0,
                MaxValue = 7
            };

            minimElixir.HideInUiWhen.Add(new SettingOption("Set Exposed Collecotors & Mines", 0));
            settings.DefineSetting(minimElixir);

            var minimGold = new AlgorithmSetting("Minimum Exposed Mines", "Minimum Gold Mines found outside before attack", 3, SettingType.ActiveAndDead)
            {
                MinValue = 0,
                MaxValue = 7
            };

            minimGold.HideInUiWhen.Add(new SettingOption("Set Exposed Collecotors & Mines", 0));
            settings.DefineSetting(minimGold);


            var useSmartZapDrills = new AlgorithmSetting("Smart Zap Drills", "replace default zap drills module with smart zap module.", 0, SettingType.ActiveAndDead);

            useSmartZapDrills.PossibleValues.Add(new SettingOption("Off", 0));
            useSmartZapDrills.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(useSmartZapDrills);

            var minDEAmount = new AlgorithmSetting("Min Dark Elixir per Zap", "we will zap only drills that have more than this amount of DE.", 200, SettingType.ActiveAndDead)
            {
                MinValue = 100,
                MaxValue = 600
            };

            minDEAmount.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(minDEAmount);

            var useEQOnDrills = new AlgorithmSetting("Use EarthQuake spell on drills", "use EarthQuake spell to gain DE from drills ", 0, SettingType.ActiveAndDead);

            useEQOnDrills.PossibleValues.Add(new SettingOption("Off", 0));
            useEQOnDrills.PossibleValues.Add(new SettingOption("On", 1));
            useEQOnDrills.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(useEQOnDrills);

            var deployHeroesAt = new AlgorithmSetting("Deploy Heroes At", "choose where to deploy Heroes", 0, SettingType.ActiveAndDead);

            deployHeroesAt.PossibleValues.Add(new SettingOption("Normal (at the end)", 0));
            deployHeroesAt.PossibleValues.Add(new SettingOption("TownHall Side", 1));
            deployHeroesAt.PossibleValues.Add(new SettingOption("DE Storage Side", 2));
            settings.DefineSetting(deployHeroesAt);

            var DeployMode = new AlgorithmSetting("Set Troops Deployment", "Select how to deploy troops around the base.", 0, SettingType.Global);

            DeployMode.PossibleValues.Add(new SettingOption("Equal Deployment (25% on 4 side)", 0));
            DeployMode.PossibleValues.Add(new SettingOption("Collectors Side (target% on each side)", 1));
            DeployMode.PossibleValues.Add(new SettingOption("Loot + Damage (deploy some on empty sides)", 2));
            settings.DefineSetting(DeployMode);

            return(settings);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            var uiEnabled = false;
            var gameCount = 0;

            Engine.Random.Instance().SetNewSeed(123);
            _colorMap = MapColors();
            var httpclient        = new ApiClient.ApiClient(new Uri("http://localhost:3000"));
            var algorithmSettings = new AlgorithmSetting <AiWeights>();
            var moves             = new Stack <Move>();

            while (true)
            {
                try
                {
                    algorithmSettings = httpclient.GetAlgorithmSettings <FeatureAi, AiWeights>(
                        new AlgorithmSetting <AiWeights> {
                        Name = "Dr Mario - Engine"
                    });
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    Console.WriteLine($"Error: retrying in a sec");
                    Thread.Sleep(1000);
                    continue;
                }

                var gameManager = new GameManager(20, 10);
                gameManager.AddBacterias(15, 3);
                var         ai           = new AiEngine(new FeatureAi(algorithmSettings.Weights));
                IEnumerator moveIterator = null;
                AI.Move     aiMove       = null;
                var         blockNumber  = -1;
                while (!gameManager.GameState.IsGameOver())
                {
                    if (uiEnabled)
                    {
                        PrintState(gameManager, moves, aiMove);
                    }

                    Thread.Sleep(2);

                    gameManager.OnGameLoopStep();

                    if (moveIterator != null && moveIterator.MoveNext())
                    {
                        gameManager.MoveBlock((Move)moveIterator.Current);
                        moves.Push((Move)moveIterator.Current);
                        continue;
                    }

                    // Make sure we only calculate best move once per spawned block.
                    if (blockNumber != gameManager.GameStats.PillsSpawned)
                    {
                        aiMove       = ai.GetNextMove(gameManager.BoardManager);
                        moveIterator = aiMove.Moves.GetEnumerator();
                        blockNumber  = gameManager.GameStats.PillsSpawned;
                    }

                    if (gameManager.Bacterias.Count < BacteriaCount)
                    {
                        var color = gameManager.Bacterias.GroupBy(x => x.Color).OrderByDescending(o => o.Count()).First().Key;
                        gameManager.AddBacteria(color);
                    }
                }

                if (uiEnabled)
                {
                    Console.Clear();
                    Console.Write("Game Over {0}", gameManager.GameStats.Fitness);
                    Console.WriteLine();
                    Console.WriteLine();
                }
                else
                {
                    Console.Write("{0}, ", gameManager.GameStats.Fitness);
                }

                try
                {
                    httpclient.PostStats(new GameResult <AiWeights>(algorithmSettings)
                    {
                        PillsSpawned = gameManager.GameStats.PillsSpawned,
                        Bacterias    = gameManager.GameStats.TotalBacteriaClearings,
                        Pills        = gameManager.GameStats.TotalPillClearings,
                        Fitness      = gameManager.GameStats.Fitness
                    });
                    gameCount++;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    Thread.Sleep(1000);
                }

                Thread.Sleep(50);
                if (uiEnabled)
                {
                    Thread.Sleep(5000);
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Загрузка значений конфигураций генетического алгоритма
        /// </summary>
        private void LoadConfig()
        {
            try
            {
                AlgorithmSetting = new AlgorithmSetting();
                //Загрузка конфигураций методик генетического алгоритма
                LoadSelectTarget();
                LoadSelectParent();
                LoadSelectCross();
                LoadSelectMutate();
                LoadSelectSelection();

                //Загрузка значений списка целевых функций
                cmboCalcFunction.Properties.Items.AddRange(funcList);
                cmboCalcFunction.EditValue = cmboCalcFunction.Properties.Items[0];

                //Выставление параметров функции
                FunctionStep = Convert.ToDouble(seFunctionStep.EditValue);
                AlgorithmSetting.FunctionStartValue  = Convert.ToInt32(seFunctionStartValue.EditValue);
                AlgorithmSetting.FunctionFinishValue = Convert.ToInt32(seFunctionFinishValue.EditValue);
                AlgorithmSetting.Accuracy            = Convert.ToInt32(seAccuracy.EditValue);

                //Выставление настроек ГА
                AlgorithmSetting.GenerationSize          = Convert.ToInt32(seGenerationSize.EditValue);
                AlgorithmSetting.PopulationSize          = Convert.ToInt32(sePopulationSize.EditValue);
                AlgorithmSetting.SelectionTreshold       = Convert.ToDouble(seSelectionTreshold.EditValue);
                AlgorithmSetting.MutationProbability     = Convert.ToDouble(seMutationProbability.EditValue);
                AlgorithmSetting.MutationGeneProbability = Convert.ToDouble(seMutationGeneProbability.EditValue);
                AlgorithmSetting.DevidePointCount        = Convert.ToInt32(seDevidePointCount.EditValue);
                AlgorithmSetting.MutateGeneCount         = Convert.ToInt32(seMutateGeneCount.EditValue);
                AlgorithmSetting.GroupSize   = Convert.ToInt32(seGroupSize.EditValue);
                AlgorithmSetting.IsDuplicate = Convert.ToBoolean(ceIsDuplicate.EditValue);
                AlgorithmSetting.IsDisplaySelectionResult = Convert.ToBoolean(ceIsDisplaySelectionResult.EditValue);
                AlgorithmSetting.IsDisplayMutateResult    = Convert.ToBoolean(ceIsDisplayMutateResult.EditValue);
                AlgorithmSetting.IsDisplayCrossResult     = Convert.ToBoolean(ceIsDisplayCrossResult.EditValue);

                // Блокирование контролов в зависимости от настроек ГА
                seDevidePointCount.Enabled        = AlgorithmSetting.SelectCross == SelectCross.CrossingoverNPoint ? true : false;
                seMutateGeneCount.Enabled         = AlgorithmSetting.SelectMutate == SelectMutate.MutateNPoint ? true : false;
                seMutationGeneProbability.Enabled = AlgorithmSetting.SelectMutate == SelectMutate.DensityMutate ? true : false;
                seSelectionTreshold.Enabled       = AlgorithmSetting.SelectSelection == SelectSelection.TruncationSelection ? true : false;
                seGroupSize.Enabled   = AlgorithmSetting.SelectSelection == SelectSelection.ClassicTournament || AlgorithmSetting.SelectSelection == SelectSelection.EqualProbabilityTournament || AlgorithmSetting.SelectSelection == SelectSelection.RouletteTournament ? true : false;
                ceIsDuplicate.Enabled = AlgorithmSetting.SelectSelection == SelectSelection.EqualProbabilityTournament || AlgorithmSetting.SelectSelection == SelectSelection.RouletteSelection || AlgorithmSetting.SelectSelection == SelectSelection.RouletteTournament ? true : false;
                ceIsDisplaySelectionResult.Enabled = AlgorithmSetting.SelectSelection == SelectSelection.RouletteSelection || AlgorithmSetting.SelectSelection == SelectSelection.ClassicTournament || AlgorithmSetting.SelectSelection == SelectSelection.EqualProbabilityTournament || AlgorithmSetting.SelectSelection == SelectSelection.RouletteTournament ? true : false;

                sbStart.Enabled = false;

                ChangeRangeTrack(AlgorithmSetting.GenerationSize);

                // Блокировка вкладки "Анализ"
                tabControl.TabPages[1].PageEnabled = false;

                AnalysisSetting = new AnalysisSetting(AlgorithmSetting)
                {
                    RunAmount = Convert.ToInt32(seRunAmount.EditValue)
                };
                LoadSelectMethod();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 8
0
        internal static AlgorithmSettings DefineSettings()
        {
            var settings = new AlgorithmSettings();

            settings.AlgorithmName           = AttackName;
            settings.AlgorithmDescriptionURL = "https://www.raccoonbot.com/forum/topic/24589-dark-push-deploy/";

            // Global Settings
            var debugMode = new AlgorithmSetting("Debug Mode", "When on, Debug Images will be written out for each attack showing what the algorithm is seeing.", 0, SettingType.Global);

            debugMode.PossibleValues.Add(new SettingOption("Off", 0));
            debugMode.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(debugMode);

            var setTargetTo = new AlgorithmSetting("Select Your Target", "", 0, SettingType.ActiveAndDead);

            setTargetTo.PossibleValues.Add(new SettingOption("TownHall", 0));
            setTargetTo.PossibleValues.Add(new SettingOption("Dark Elixir Storage", 1));
            setTargetTo.PossibleValues.Add(new SettingOption("Eagle Artilary", 2));
            settings.DefineSetting(setTargetTo);

            var UseQueenWalk = new AlgorithmSetting("Use Queen Walk", "When on, healer will be used for Queen walk, When off: it will be used for Bowler and Witch walk", 0, SettingType.ActiveAndDead);

            UseQueenWalk.PossibleValues.Add(new SettingOption("Off", 0));
            UseQueenWalk.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(UseQueenWalk);

            // Show These ONLY when Use Queen Walk Mode is on
            var HealersForQueenWalk = new AlgorithmSetting("Number of healers to use on Queen", "How meny healers to follow the queen , the rest will be dropped on the main troops", 4, SettingType.ActiveAndDead)
            {
                MinValue = 1,
                MaxValue = 8
            };

            HealersForQueenWalk.HideInUiWhen.Add(new SettingOption("Use Queen Walk", 0));
            settings.DefineSetting(HealersForQueenWalk);

            var UseRageForQW = new AlgorithmSetting("Drop 1 rage in the first of the QW", "use 1 rage on the Queen To help fast funnelling", 0, SettingType.ActiveAndDead);

            UseRageForQW.PossibleValues.Add(new SettingOption("Off", 0));
            UseRageForQW.PossibleValues.Add(new SettingOption("On", 1));
            UseRageForQW.HideInUiWhen.Add(new SettingOption("Use Queen Walk", 0));
            settings.DefineSetting(UseRageForQW);

            var useCCAs = new AlgorithmSetting("use Clan Castle troops as", "", 0, SettingType.ActiveAndDead);

            useCCAs.PossibleValues.Add(new SettingOption("Normal troops (deploy at the end)", 0));
            useCCAs.PossibleValues.Add(new SettingOption("Golem (deploy at the first)", 1));
            useCCAs.PossibleValues.Add(new SettingOption("Giants (deploy before normal troops)", 2));
            settings.DefineSetting(useCCAs);

            var ShiftSpells = new AlgorithmSetting("Shift Spells In(+) and Out(-)", "Shift spells to inward or upward", 0, SettingType.ActiveAndDead)
            {
                MinValue = -5,
                MaxValue = 5
            };

            settings.DefineSetting(ShiftSpells);

            var customDeployOrder = new AlgorithmSetting("use custom deploy order", "Change the deploying troops order, the default order is: 1-Golems if more than 1, 2- funnling, 3-giants or one golem, 4-heroes, 5-wallBreakers, 6-Normal troops", 0, SettingType.Global);

            customDeployOrder.PossibleValues.Add(new SettingOption("Off", 0));
            customDeployOrder.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(customDeployOrder);

            // Deploy order if custom deploy is on
            var deploy1 = new AlgorithmSetting("#1", "", 1, SettingType.Global);

            deploy1.PossibleValues.Add(new SettingOption("Golems", 1));
            deploy1.PossibleValues.Add(new SettingOption("Ground Funnelling", 2));
            deploy1.PossibleValues.Add(new SettingOption("Giants", 3));
            deploy1.PossibleValues.Add(new SettingOption("Heroes", 4));
            deploy1.PossibleValues.Add(new SettingOption("Wall Breakers", 5));
            deploy1.PossibleValues.Add(new SettingOption("Normal Troops", 6));
            deploy1.PossibleValues.Add(new SettingOption("Balloons", 7));
            deploy1.PossibleValues.Add(new SettingOption("BabyDragons", 8));
            deploy1.PossibleValues.Add(new SettingOption("Lava", 9));
            deploy1.PossibleValues.Add(new SettingOption("Dragons", 10));
            deploy1.PossibleValues.Add(new SettingOption("Air Funnelling", 11));
            deploy1.HideInUiWhen.Add(new SettingOption("use custom deploy order", 0));
            settings.DefineSetting(deploy1);

            var deploy2 = new AlgorithmSetting("#2", "", 2, SettingType.Global);

            deploy2.PossibleValues.Add(new SettingOption("Golems", 1));
            deploy2.PossibleValues.Add(new SettingOption("Ground Funnelling", 2));
            deploy2.PossibleValues.Add(new SettingOption("Giants", 3));
            deploy2.PossibleValues.Add(new SettingOption("Heroes", 4));
            deploy2.PossibleValues.Add(new SettingOption("Wall Breakers", 5));
            deploy2.PossibleValues.Add(new SettingOption("Normal Troops", 6));
            deploy2.PossibleValues.Add(new SettingOption("Balloons", 7));
            deploy2.PossibleValues.Add(new SettingOption("BabyDragons", 8));
            deploy2.PossibleValues.Add(new SettingOption("Lava", 9));
            deploy2.PossibleValues.Add(new SettingOption("Dragons", 10));
            deploy2.PossibleValues.Add(new SettingOption("Air Funnelling", 11));
            deploy2.HideInUiWhen.Add(new SettingOption("use custom deploy order", 0));
            settings.DefineSetting(deploy2);

            var deploy3 = new AlgorithmSetting("#3", "", 3, SettingType.Global);

            deploy3.PossibleValues.Add(new SettingOption("Golems", 1));
            deploy3.PossibleValues.Add(new SettingOption("Ground Funnelling", 2));
            deploy3.PossibleValues.Add(new SettingOption("Giants", 3));
            deploy3.PossibleValues.Add(new SettingOption("Heroes", 4));
            deploy3.PossibleValues.Add(new SettingOption("Wall Breakers", 5));
            deploy3.PossibleValues.Add(new SettingOption("Normal Troops", 6));
            deploy3.PossibleValues.Add(new SettingOption("Balloons", 7));
            deploy3.PossibleValues.Add(new SettingOption("BabyDragons", 8));
            deploy3.PossibleValues.Add(new SettingOption("Lava", 9));
            deploy3.PossibleValues.Add(new SettingOption("Dragons", 10));
            deploy3.PossibleValues.Add(new SettingOption("Air Funnelling", 11));
            deploy3.HideInUiWhen.Add(new SettingOption("use custom deploy order", 0));
            settings.DefineSetting(deploy3);

            var deploy4 = new AlgorithmSetting("#4", "", 4, SettingType.Global);

            deploy4.PossibleValues.Add(new SettingOption("Golems", 1));
            deploy4.PossibleValues.Add(new SettingOption("Ground Funnelling", 2));
            deploy4.PossibleValues.Add(new SettingOption("Giants", 3));
            deploy4.PossibleValues.Add(new SettingOption("Heroes", 4));
            deploy4.PossibleValues.Add(new SettingOption("Wall Breakers", 5));
            deploy4.PossibleValues.Add(new SettingOption("Normal Troops", 6));
            deploy4.PossibleValues.Add(new SettingOption("Balloons", 7));
            deploy4.PossibleValues.Add(new SettingOption("BabyDragons", 8));
            deploy4.PossibleValues.Add(new SettingOption("Lava", 9));
            deploy4.PossibleValues.Add(new SettingOption("Dragons", 10));
            deploy4.PossibleValues.Add(new SettingOption("Air Funnelling", 11));
            deploy4.HideInUiWhen.Add(new SettingOption("use custom deploy order", 0));
            settings.DefineSetting(deploy4);

            var deploy5 = new AlgorithmSetting("#5", "", 5, SettingType.Global);

            deploy5.PossibleValues.Add(new SettingOption("Golems", 1));
            deploy5.PossibleValues.Add(new SettingOption("Ground Funnelling", 2));
            deploy5.PossibleValues.Add(new SettingOption("Giants", 3));
            deploy5.PossibleValues.Add(new SettingOption("Heroes", 4));
            deploy5.PossibleValues.Add(new SettingOption("Wall Breakers", 5));
            deploy5.PossibleValues.Add(new SettingOption("Normal Troops", 6));
            deploy5.PossibleValues.Add(new SettingOption("Balloons", 7));
            deploy5.PossibleValues.Add(new SettingOption("BabyDragons", 8));
            deploy5.PossibleValues.Add(new SettingOption("Lava", 9));
            deploy5.PossibleValues.Add(new SettingOption("Dragons", 10));
            deploy5.PossibleValues.Add(new SettingOption("Air Funnelling", 11));
            deploy5.HideInUiWhen.Add(new SettingOption("use custom deploy order", 0));
            settings.DefineSetting(deploy5);

            var deploy6 = new AlgorithmSetting("#6", "", 6, SettingType.Global);

            deploy6.PossibleValues.Add(new SettingOption("Golems", 1));
            deploy6.PossibleValues.Add(new SettingOption("Ground Funnelling", 2));
            deploy6.PossibleValues.Add(new SettingOption("Giants", 3));
            deploy6.PossibleValues.Add(new SettingOption("Heroes", 4));
            deploy6.PossibleValues.Add(new SettingOption("Wall Breakers", 5));
            deploy6.PossibleValues.Add(new SettingOption("Normal Troops", 6));
            deploy6.PossibleValues.Add(new SettingOption("Balloons", 7));
            deploy6.PossibleValues.Add(new SettingOption("BabyDragons", 8));
            deploy6.PossibleValues.Add(new SettingOption("Lava", 9));
            deploy6.PossibleValues.Add(new SettingOption("Dragons", 10));
            deploy6.PossibleValues.Add(new SettingOption("Air Funnelling", 11));
            deploy6.HideInUiWhen.Add(new SettingOption("use custom deploy order", 0));
            settings.DefineSetting(deploy6);

            return(settings);
        }
Esempio n. 9
0
        /// <summary>
        /// Allows any Algorithm Dev to specify their own Settings.
        /// </summary>
        /// <returns>A Template of Settings to Dynamically build the UI for - so the Bot User can customize the settings.</returns>
        internal static AlgorithmSettings DefineSettings()
        {
            var settings = new AlgorithmSettings();

            settings.AlgorithmName           = algorithmName;
            settings.AlgorithmDescriptionURL = "http://www.raccoonbot.com/forum/topic/22848-human-barch-deploy/";

            var debugMode = new AlgorithmSetting("Debug Mode", "When on, Debug Images will be written out for each attack showing what the algorithm is seeing.", 1, SettingType.Global);

            debugMode.PossibleValues.Add(new SettingOption("Off", 0));
            debugMode.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(debugMode);

            var ignoreGold = new AlgorithmSetting("Ignore Gold", "When on, The algorithm will not target Gold Collectors/Storages.", 0, SettingType.Global);

            ignoreGold.PossibleValues.Add(new SettingOption("Off", 0));
            ignoreGold.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(ignoreGold);

            var ignoreElixir = new AlgorithmSetting("Ignore Elixir", "When on, The algorithm will not target Elixir Collectors/Storages.", 0, SettingType.Global);

            ignoreElixir.PossibleValues.Add(new SettingOption("Off", 0));
            ignoreElixir.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(ignoreElixir);

            var minExposedTargets = new AlgorithmSetting("Minimum Exposed Targets", "Minimum number of Collectors/Drills/Storages that are on the outside of the base - before the attack phase will start.", 3, SettingType.ActiveAndDead);

            minExposedTargets.PossibleValues.Add(new SettingOption("1", 1));
            minExposedTargets.PossibleValues.Add(new SettingOption("2", 2));
            minExposedTargets.PossibleValues.Add(new SettingOption("3", 3));
            minExposedTargets.PossibleValues.Add(new SettingOption("4", 4));
            minExposedTargets.PossibleValues.Add(new SettingOption("5", 5));
            minExposedTargets.PossibleValues.Add(new SettingOption("6", 6));
            minExposedTargets.PossibleValues.Add(new SettingOption("7", 7));
            minExposedTargets.PossibleValues.Add(new SettingOption("8", 8));
            settings.DefineSetting(minExposedTargets);

            var maximumDistanceToTarget = new AlgorithmSetting("Acceptable Target Range", "Specify the maximum number of tiles a target can be from the ouside of the base. (Collectors/Drills/Storages furthor inside than this will not be targeted.)", 9, SettingType.ActiveAndDead);

            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("2", 2));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("3", 3));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("4", 4));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("5", 5));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("6", 6));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("7", 7));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("8", 8));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("9", 9));
            maximumDistanceToTarget.PossibleValues.Add(new SettingOption("10", 10));
            settings.DefineSetting(maximumDistanceToTarget);

            var minFillLevel = new AlgorithmSetting("Min Collector Fill Level", "The minimum Fullness of Collectors to Attack. (5-50)", 26, SettingType.ActiveOnly);

            minFillLevel.MinValue = 5;
            minFillLevel.MaxValue = 50;
            settings.DefineSetting(minFillLevel);

            var minAvgCollectorLvl = new AlgorithmSetting("Min Average Collector Level", "Specify the Average Collector Level to accept when attacking live bases. (6-12)", 9, SettingType.ActiveOnly);

            minAvgCollectorLvl.MinValue = 6;
            minAvgCollectorLvl.MaxValue = 12;
            settings.DefineSetting(minAvgCollectorLvl);

            var deployAllTroops = new AlgorithmSetting("Deploy All Troops Mode", "When Turned on, The Algorithm Will divide all available troops by number of valid targets, and Deploy all Troops in the First Wave.", 1, SettingType.ActiveAndDead);

            deployAllTroops.PossibleValues.Add(new SettingOption("On", 1));
            deployAllTroops.PossibleValues.Add(new SettingOption("Off", 0));
            settings.DefineSetting(deployAllTroops);

            var groundUnits = new AlgorithmSetting("Ground Units Per Target", "Specify the number of Ground units (Barbs, Goblins etc.) to deploy at each Target.", 10, SettingType.ActiveAndDead);

            groundUnits.MinValue = 1;
            groundUnits.MaxValue = 25;
            groundUnits.HideInUiWhen.Add(new SettingOption("Deploy All Troops Mode", 1));
            settings.DefineSetting(groundUnits);

            var rangedUnits = new AlgorithmSetting("Ranged Units Per Target", "Specify the number of Ranged units (Archers, Minions etc.) to deploy at each Target.", 8, SettingType.ActiveAndDead);

            rangedUnits.MinValue = 1;
            rangedUnits.MaxValue = 25;
            rangedUnits.HideInUiWhen.Add(new SettingOption("Deploy All Troops Mode", 1));
            settings.DefineSetting(rangedUnits);

            var tankUnits = new AlgorithmSetting("Tank Units Per Target", "Specify the number of Tanks (Giants) to deploy at each target.", 1, SettingType.ActiveAndDead);

            tankUnits.PossibleValues.Add(new SettingOption("1", 1));
            tankUnits.PossibleValues.Add(new SettingOption("2", 2));
            tankUnits.HideInUiWhen.Add(new SettingOption("Deploy All Troops Mode", 1));
            settings.DefineSetting(tankUnits);

            var valksAsTanks = new AlgorithmSetting("Use Valkyries as Tanks", "When on, The algorithm will classify Valkyries as Tank Units, and deploy before other Ground and Ranged units.", 0, SettingType.ActiveAndDead);

            valksAsTanks.PossibleValues.Add(new SettingOption("Off", 0));
            valksAsTanks.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(valksAsTanks);

            return(settings);
        }
Esempio n. 10
0
        internal static AlgorithmSettings DefineSettings()
        {
            var settings = new AlgorithmSettings()
            {
                AlgorithmName           = AttackName,
                AlgorithmDescriptionURL = "https://www.raccoonbot.com/forum/topic/24589-dark-push-deploy/"
            };

            // Global Settings.
            var debugMode = new AlgorithmSetting("Debug Mode", "When on, Debug Images will be written out for each attack showing what the algorithm is seeing.", 0, SettingType.Global);

            debugMode.PossibleValues.Add(new SettingOption("Off", 0));
            debugMode.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(debugMode);

            var setCollMines = new AlgorithmSetting("Set Exposed Collecotors & Mines", "turn on and off searching for outside elixir collectors and gold mines.", 1, SettingType.ActiveAndDead);

            setCollMines.PossibleValues.Add(new SettingOption("Off", 0));
            setCollMines.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(setCollMines);

            // Show These ONLY when Set Exposed Collecotors & Mines is on.
            var minDistance = new AlgorithmSetting("Acceptable Target Range", "the maximun numbers of tiles the collectors and drills can be far from red line", 6, SettingType.ActiveAndDead)
            {
                MinValue = 2,
                MaxValue = 10
            };

            minDistance.HideInUiWhen.Add(new SettingOption("Set Exposed Collecotors & Mines", 0));
            settings.DefineSetting(minDistance);

            var minimElixir = new AlgorithmSetting("Minimum Exposed Colloctors", "Minimum Elixir Colloctores found outside before attack", 3, SettingType.ActiveAndDead)
            {
                MinValue = 0,
                MaxValue = 7
            };

            minimElixir.HideInUiWhen.Add(new SettingOption("Set Exposed Collecotors & Mines", 0));
            settings.DefineSetting(minimElixir);

            var minimGold = new AlgorithmSetting("Minimum Exposed Mines", "Minimum Gold Mines found outside before attack", 3, SettingType.ActiveAndDead)
            {
                MinValue = 0,
                MaxValue = 7
            };

            minimGold.HideInUiWhen.Add(new SettingOption("Set Exposed Collecotors & Mines", 0));
            settings.DefineSetting(minimGold);


            var useSmartZapDrills = new AlgorithmSetting("Smart Zap Drills", "use lighting Drills with smart way to save lighting spells if no need to use (please disable default Lighting drills if you select this option)", 0, SettingType.ActiveAndDead);

            useSmartZapDrills.PossibleValues.Add(new SettingOption("Off", 0));
            useSmartZapDrills.PossibleValues.Add(new SettingOption("On", 1));
            settings.DefineSetting(useSmartZapDrills);

            // Show These ONLY when Smart Zap Drills is on.
            var startZapAfter = new AlgorithmSetting("Start Zap Drills After ?(sec)", "change when bot start to use smart zap , this time start from deployment is done with all troops", 30, SettingType.ActiveAndDead)
            {
                MinValue = 10,
                MaxValue = 60
            };

            startZapAfter.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(startZapAfter);

            var minDrillLvl = new AlgorithmSetting("Min Drill Level", "select minimum level of the drill to be zapped", 3, SettingType.ActiveAndDead)
            {
                MinValue = 1,
                MaxValue = 6
            };

            minDrillLvl.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(minDrillLvl);

            var minDEAmount = new AlgorithmSetting("Min Dark Elixir per Zap", "we will zap only drills that have more than this amount of DE.", 200, SettingType.ActiveAndDead)
            {
                MinValue = 100,
                MaxValue = 600
            };

            minDEAmount.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(minDEAmount);

            var useEQOnDrills = new AlgorithmSetting("Use EarthQuake spell on drills", "use EarthQuake spell to gain DE from drills ", 0, SettingType.ActiveAndDead);

            useEQOnDrills.PossibleValues.Add(new SettingOption("Off", 0));
            useEQOnDrills.PossibleValues.Add(new SettingOption("On", 1));
            useEQOnDrills.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(useEQOnDrills);

            var endBattleAfterZap = new AlgorithmSetting("End Battle after zap ?(sec)", "end battle after this time in sec after Smart Zap is done (0 is disabled)", 10, SettingType.ActiveAndDead)
            {
                MinValue = 0,
                MaxValue = 60
            };

            endBattleAfterZap.HideInUiWhen.Add(new SettingOption("Smart Zap Drills", 0));
            settings.DefineSetting(endBattleAfterZap);

            var deployHeroesAt = new AlgorithmSetting("Deploy Heroes At", "choose where to deploy Heroes", 0, SettingType.ActiveAndDead);

            deployHeroesAt.PossibleValues.Add(new SettingOption("Normal (at the end)", 0));
            deployHeroesAt.PossibleValues.Add(new SettingOption("TownHall Side", 1));
            deployHeroesAt.PossibleValues.Add(new SettingOption("DE storage Side", 1));
            settings.DefineSetting(deployHeroesAt);



            return(settings);
        }