public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
        {
            base.Setup(nI, rI, cI, oI, rPI, cPI, colI, area, timeLimit);

            actionStatesCircle[currentStateCircle].Setup(nI, rI, cI, oI, rPI, cPI, colI, area, timeLimit);
            actionStatesRectangle[currentStateRectangle].Setup(nI, rI, cI, oI, rPI, cPI, colI, area, timeLimit);
        }
Beispiel #2
0
 public void GetCountInformation(out CountInformation info)
 {
     _nodeT.GetCountInformation(out info);
     if (info.MaximumLength.HasValue)
     {
         info.MaximumLength = Math.Max(0, info.MaximumLength.Value - _count);
     }
 }
Beispiel #3
0
        /********************************************************************************************/
        /********************************************************************************************/
        /***                                                                                      ***/
        /***                                     MAIN SETUP                                       ***/
        /***                                                                                      ***/
        /********************************************************************************************/
        /********************************************************************************************/

        //implements abstract rectangle interface: used to setup the initial information so that the agent has basic knowledge about the level
        public void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
        {
            ground                 = new Platform(0, area.Bottom, 0, 0, PlatformType.Black);
            utils                  = new Utils(ground, circleInfo.Radius, area);
            numbersInfo            = nI;
            nCollectiblesLeft      = nI.CollectiblesCount;
            rectangleInfo          = rI;
            circleInfo             = cI;
            obstaclesInfo          = utils.joinObstacles(oI, rPI);
            rectanglePlatformsInfo = rPI;
            circlePlatformsInfo    = cPI;
            collectiblesInfo       = colI;
            uncaughtCollectibles   = new List <CollectibleRepresentation>(collectiblesInfo);
            this.area              = area;
            gSpeed                 = 1.0f;
            goalMode               = GoalType.FirstPossible;

            //setup level layout
            levelLayout = utils.getLevelLayout(obstaclesInfo, area);

            //calculates the area of the rectangle since only the info of the height is available
            rectangleArea = utils.setRectangleArea(rectangleInfo.Height);

            //gets the initial position of the Rectangle to test is the game has started or is still at the menu
            previousRectanglePosX = rectangleInfo.X;
            previousRectanglePosY = rectangleInfo.Y;

            Platforms = utils.setupPlatforms(obstaclesInfo, rPI, cPI);
            Diamonds  = utils.setupDiamonds(collectiblesInfo, levelLayout);

            /*************TESTS*************/
            //inform a level has started
            utils.writeStart(1);

            //search - state - original; action - original; no partial plans
            //RRT = new RRTUtilsGS(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.Original, RRTTypes.Original, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);
            //search - state - original; action - STP; biasSTP - 0.25/0.5/0.75; no partial plans
            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.Original, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);
            //search - state - bias - 0.25/0.50/0.75; action - STP; biasSTP;  no partial plans
            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.Bias, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);
            //search - state - bgt - 10/50/10; action - STP; biasSTP; no partial plans
            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.BGT, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);
            //search - state - bgt zoom - 50; action - STP; biasSTP; no partial plans
            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.BGTAreaBias, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);
            //search - state - bgt bias - 50; action - STP; biasSTP; no partial plans
            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.BGTBias, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);
            //search - state - zoom; action - STP; biasSTP; no partial plans
            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.AreaBias, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);

            /*************FINAL*************/
            RRT = new RRTUtilsGS(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.BGT, RRTTypes.STP, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, true, true);

            //RRT = new RRTUtils(actionTime, simTime, simTimeFinish, getPossibleMoves(), type, area, collectiblesInfo.Length, RRTTypes.BGT, RRTTypes.Original, obstaclesInfo, gSpeed, Diamonds, Platforms, utils, false, false);

            RRT.setRadius(rectangleInfo.Height / 2);
            pathPlan   = new PathPlan(cutplan, colI.GetLength(0), utils);
            controller = new RectangleController(gSpeed, utils);
        }
Beispiel #4
0
 public virtual void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
 {
     this.nI   = nI;
     this.rI   = rI;
     this.cI   = cI;
     this.oI   = oI;
     this.rPI  = rPI;
     this.cPI  = cPI;
     this.colI = colI;
     this.area = area;
 }
Beispiel #5
0
 public void GetCountInformation(out CountInformation info)
 {
     _nodeT.GetCountInformation(out info);
     if (_count <= 0)
     {
         info = new CountInformation(0, true);
     }
     else if (info.MaximumLength.HasValue)
     {
         info.MaximumLength = Math.Min(info.MaximumLength.Value, _count);
     }
 }
Beispiel #6
0
        public async Task <TItem> GetParkInfo <TItem>()
        {
            Logger.LogDebug($"{nameof(InformationService)}.{nameof(GetParkInfo)}()");
            var items = await _informationRepository.GetParkInfo();

            int dinosaursCount = await _dinosaursRepository.DinosaursCount();

            int speciesCount = await _dinosaursRepository.SpeciesCount();

            var countInformation = new CountInformation(speciesCount, dinosaursCount);

            return(Mapper.Map <TItem>((items, countInformation)));
        }
        //implements abstract rectangle interface: used to setup the initial information so that the agent has basic knowledge about the level
        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;

            //DebugSensorsInfo();
        }
 public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
 {
     //convert to old way in order to maintain compatibility
     DeprecatedSetup(
         nI.ToArray(),
         rI.ToArray(),
         cI.ToArray(),
         ObstacleRepresentation.RepresentationArrayToFloatArray(oI),
         ObstacleRepresentation.RepresentationArrayToFloatArray(rPI),
         ObstacleRepresentation.RepresentationArrayToFloatArray(cPI),
         CollectibleRepresentation.RepresentationArrayToFloatArray(colI),
         area,
         timeLimit);
 }
 //implements abstract circle interface: used to setup the initial information so that the agent has basic knowledge about the level
 public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
 {
     singlePlayer = new CircleSingleplayer(cutplan, testing, timer);
     //check if it is a single or multiplayer level
     if (rI.X < 0 || rI.Y < 0)
     {
         //if the circle has negative position then this is a single player level
         gameMode = 0;
         singlePlayer.Setup(nI, rI, cI, oI, rPI, cPI, colI, area, timeLimit);
     }
     else
     {
         gameMode    = 1;
         multiPlayer = new CircleCoopAgent(area, colI, oI, rPI, cPI);
         multiPlayer.Setup(nI, rI, cI, oI, rPI, cPI, colI, area, timeLimit);
     }
 }
        public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
        {
            CountInformation nIFixed = new CountInformation(nI.ObstaclesCount + (rectangleAsPlatform ? 1 : 0), nI.RectanglePlatformsCount, nI.CirclePlatformsCount, 1);

            ObstacleRepresentation[] oIFixed;

            if (rectangleAsPlatform)
            {
                List <ObstacleRepresentation> oIList = new List <ObstacleRepresentation>(oI);
                oIList.Add(new ObstacleRepresentation(rI.X, rI.Y, rectangleArea / rI.Height, rI.Height));

                oIFixed = oIList.ToArray();
            }
            else
            {
                oIFixed = oI;
            }

            singleplayer.Setup(nIFixed, rI, cI, oIFixed, rPI, cPI, objectiveDiamond, area, timeLimit);
            setup = true;
        }
Beispiel #11
0
        public void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
        {
            //Splits the diamonds into each category
            actionRules = coopRules.ApplyRules(cI, rI);

            if (actionRules == null || actionRules.Count == 0)
            {
                finished = true;
                return;
            }

            actionRules[currentAction].Setup(nI, rI, cI, oI, rPI, cPI, colI, area, 100.0);

            this.nI   = nI;
            this.rI   = rI;
            this.cI   = cI;
            this.oI   = oI;
            this.rPI  = rPI;
            this.cPI  = cPI;
            this.colI = colI;
            this.area = area;
        }
Beispiel #12
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();
        }
Beispiel #13
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();
        }
Beispiel #14
0
 public void GetCountInformation(out CountInformation info)
 {
     _nodeT.GetCountInformation(out info);
     info.PotentialSideEffects = true;
 }
 public void GetCountInformation(out CountInformation info) => Impl.CountInfo(out info);
Beispiel #16
0
 public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
 {
     previousHeight = rI.Height;
 }
 public void GetCountInformation(out CountInformation info)
 {
     _nodeT.GetCountInformation(out info);
     info.ActualLengthIsMaximumLength &= info.MaximumLength == 0;
 }
Beispiel #18
0
 public void GetCountInformation(out CountInformation info) =>
 info = new CountInformation(_memory.Length, true);
Beispiel #19
0
 public virtual void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
 {
 }
 public void GetCountInformation(out CountInformation info) =>
 EnumerableNode.GetCountInformation(_enumerable, out info);
 public void GetCountInformation(out CountInformation info) => throw new NotSupportedException();
Beispiel #22
0
 public void GetCountInformation(out CountInformation info) =>
 info = new CountInformation(1, true);
Beispiel #23
0
 public void GetCountInformation(out CountInformation info) =>
 info = new CountInformation(_max - _start + 1, true);
Beispiel #24
0
 public void GetCountInformation(out CountInformation info) =>
 info = new CountInformation(_list.Count, false);
Beispiel #25
0
 internal static void CountInfo(out CountInformation info)
 => throw new InvalidOperationException("Aggregation objects provide no count");
 public override void Setup(CountInformation nI, RectangleRepresentation rI, CircleRepresentation cI, ObstacleRepresentation[] oI, ObstacleRepresentation[] rPI, ObstacleRepresentation[] cPI, CollectibleRepresentation[] colI, Rectangle area, double timeLimit)
 {
     circleSingleplayer.Setup(nI, rI, cI, oI, rPI, cPI, objectiveDiamond, area, timeLimit);
     setup = true;
 }
Beispiel #27
0
 public void GetCountInformation(out CountInformation info) =>
 info = new CountInformation(_getSpan(_obj).Length, true);