Exemplo n.º 1
0
        /// <summary>
        /// Triggers the new game.
        /// </summary>
        private void TriggerNewGame()
        {
            // Randomly tweak some inputs.
            Random r = new Random();

            // Select optimization model.
            if (Configurations.GameGenerationMode() == GameGenMode.HillClimbing)
            {
                _climber.FindOptimalSolution();
            }
            else if (Configurations.GameGenerationMode() == GameGenMode.HillClimbing2)
            {
                _climber.FindOptimalSolution2();
            }
            else
            {
                int randomNum = r.Next(5);
                while (!_climber.GenerateRandomSolution(randomNum))
                {
                    randomNum = r.Next(5);
                }
            }

            double[] input = new double[10];

            input = _climber.GetInputData;

            // Get a bunch of custom input stuff.
            if (Configurations.UseCustomP1Input)
            {
                double[] newInput = Configurations.RetrievePlayer1Input();

                for (int i = 0; i < 5; i++)
                {
                    input[i] = newInput[i];
                }
            }

            double[] p2Input = new double[]
            {
                input[5],
                input[6],
                input[7],
                input[8],
                input[9]
            };

            _currentStats.GetInputParams = p2Input;
            _currentStats.GenerateNewAiFile(_aiScript);
            StreamUtilities.GenerateNewInput(input);
        }