コード例 #1
0
        /// <summary>
        /// Move onto the nexts round.
        /// </summary>
        public void nextRound()
        {
            //add to the number of the AI fighters
            fighterCounter += 1;
            AiFighter.Number = fighterCounter;
            NoAiFighter.Number = fighterCounter;
            

            //reset both fighter for next round
            AiFighter.Health = 100;
            NoAiFighter.Health = 100;
            //update round information
            roundNum++;
            treeCounter++;

            if (treeCounter == population_size) { treeCounter = 1; }
            //10
            //handle selection of next Behaiour tree for AI player
            AiFighter.Tree = gp.Generation[treeCounter-1];
            //

            //add non ai fighter to next round in list
            listOfEvents.Add(NoAiFighter.ToString());
            //add AI fighter to list
            listOfEvents.Add(AiFighter.ToString());
            //listOfEvents.Add(":: ROUND "+roundNum+" FIGHT ::");
        }
コード例 #2
0
        /// <summary>
        /// Set up fighters for fight.
        /// </summary>
        /// <param name="isBlocking">if set to <c>true</c> [is blocking].</param>
        /// <param name="isCrouched">if set to <c>true</c> [is crouched].</param>
        /// <param name="torn_size"></param>
        /// <param name="pop_size"></param>
        public void SetUp(bool isBlocking, bool isCrouched, int torn_size, int pop_size) 
        {
            //reset the counters
            treeCounter = 0;
            fighterCounter = 0;
            roundNum = 0;

            ListEventsAlgorithm.Clear();
            ListOfEvents.Clear();

            listOfEvents.Add(":: SET-UP FIGHTERS ::");

            roundNum++;

            listOfEvents.Add("Round NO: " + roundNum);

            //CREATE new NON_AI_FIGHTER
            NoAiFighter = new NonAIFighter(roundNum, isBlocking, isCrouched);

            //set relevent values for NON_AI_FIGHTER
            //NoAiFighter.Blocking = isBlocking;
            //NoAiFighter.Crouching = isCrouched;
            //add new fighter o event list
            listOfEvents.Add(NoAiFighter.ToString());

            //CREATE new AI_FIGHTER
            AiFighter = new AIFighter(roundNum);

             //create a new connection to Genetic programming class
            gp = new GeneticProgramming(this, AiFighter, NoAiFighter,torn_size,pop_size);

            gp.Crouched = Crouched;
            gp.Close = Close;
            gp.Medium = Medium;
            gp.Far = Far;

            //set up the Genetic programming class
            gp.setup();

            //set tree to first in generation list
            treeCounter = 0;
            AiFighter.Tree = gp.Generation[treeCounter];

            //add AI fighter to list
            listOfEvents.Add(AiFighter.ToString());
        }