Exemple #1
0
        // See [email protected] for parameter details
        public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
        {
            numbersInfo            = nI;
            nCollectiblesLeft      = nI.CollectiblesCount;
            rectangleInfo          = rI;
            circleInfo             = cI;
            obstaclesInfo          = oI;
            rectanglePlatformsInfo = rPI;
            circlePlatformsInfo    = cPI;
            collectiblesInfo       = colI;
            this.area = area;

            //send a message to the rectangle informing that the circle setup is complete and show how to pass an attachment: a pen object
            messages.Add(new AgentMessage("Setup complete, testing to send an object as an attachment.", new Pen(Color.BlanchedAlmond)));

            this.runAStar(rI, cI, oI, rPI, cPI, colI, area);

            this.movementAnalyser = new MovementAnalyser(this.matrix);

            InitDiamondsToCatch();

            //DebugSensorsInfo();
        }
Exemple #2
0
        /// <summary>
        /// implements abstract circle interface: used to setup the initial information so that the agent has basic knowledge about the level
        /// </summary>
        /// <param name="nI">This structure contains the number of obstacles, the number of character specific platforms (Circle & Rectangle Platforms) and the total number of purple diamonds within the level.</param>
        /// <param name="rI">This structure contains the current information on the rectangle agent, such as position (X and Y), velocity (X and Y) and its current height.</param>
        /// <param name="cI">This array contains the current information on the circle agent, such as position (X and Y) and velocity (X and Y).</param>
        /// <param name="oI">This array contains all the information about the obstacles (default obstacles, not character specific obstacles) in the level, such as the center coordinates of the platform (X and Y) and the platform’s height and width.</param>
        /// <param name="rPI">This array contains all the information about Rectangle specific platforms in the level, such as the center coordinates of the platform (X and Y) and the platform’s height and width.</param>
        /// <param name="cPI">This array contains all the information about Circle specific platforms in the level, such as the center coordinates of the platform (X and Y) and the platform’s height and width.</param>
        /// <param name="colI">This array contains the information about the coordinates (center X and Y positions) of all the collectibles (purple diamonds) in the level.</param>
        /// <param name="area">Specifies the definition of the rectangle area in which the game unfolds.</param>
        /// <param name="timeLimit">Specifies the amount of time the agent has to solve the level during the competition.</param>
        public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
        {
            this.numbersInfo            = nI;
            this.nCollectiblesLeft      = nI.CollectiblesCount;
            this.rectangleInfo          = rI;
            this.circleInfo             = cI;
            this.obstaclesInfo          = oI;
            this.rectanglePlatformsInfo = rPI;
            this.circlePlatformsInfo    = cPI;
            this.collectiblesInfo       = colI;
            this.uncaughtCollectibles   = new List <CollectibleRepresentation>(collectiblesInfo);
            this.area = area;

            //send a message to the rectangle informing that the circle setup is complete and show how to pass an attachment: a pen object
            this.messages.Add(new AgentMessage("Setup complete, testing to send an object as an attachment.", new Pen(Color.AliceBlue)));

            // create game matrix
            this.matrix = Matrix.generateMatrixFomGameInfo(rI, cI, oI, rPI, cPI, colI, area);

            // create graph with reachable paths according to A*
            this.runAStarForInitialPaths(rI, cI, oI, rPI, cPI, colI, area);

            // create restrictions related to movement according to level data
            this.movementAnalyser = new MovementAnalyser(this.matrix);

            // initialize the diamonds to catch according to the A* known paths and movement restrictions
            this.initDiamondsToCatch();

            // initialize state machine to catch diamonds
            if (!Utils.AIAD_DEMO_A_STAR_INITIAL_PATHS)
            {
                this.pathsToFollowStateMachine();
            }

            DebugSensorsInfo();
        }