public NodeArrayAStarPathFinding(WorldModel WM, IHeuristic heuristic) : base(WM,null,null,heuristic) { this.NodeRecordArray = new NodeRecordArray(WM); this.lstars = new List<NodeRecord>(); this.Open = this.NodeRecordArray; this.Closed = this.NodeRecordArray; }
public AStarPathfinding(WorldModel WM, IOpenSet open, IClosedSet closed, IHeuristic heuristic) : base(WM) { this.Open = open; this.Closed = closed; this.NodesPerSearch = uint.MaxValue; //by default we process all nodes in a single request this.InProgress = false; this.Heuristic = heuristic; }
public DecisionMakingProcess (WorldModel WM) : base(WM) { this.AStar = new NodeArrayAStarPathFinding(WM, new ZeroHeuristic()); this.Manual = new InstructionManualProcessor(WM); this.CurrentConnectionID = -1; this.CurrentActionID = -1; this.CurrentRectangle = WM.Character; this.CurrentSolution = new int[0]; }
public NodeRecordArray(WorldModel WM) : base(WM) { this.NodeRecords = new NodeRecord[WM.Mesh.Count()]; for(int i = 0; i < WM.Mesh.Count(); i++) { var node = WM.Mesh[i]; this.NodeRecords[i] = new NodeRecord {node = node, status = NodeStatus.Unvisited}; } this.SpecialCaseNodes = new List<NodeRecord>(); this.Open = new NodePriorityHeap(); }
//Reads the file and makes a security backup public InstructionManualProcessor(WorldModel WM) : base(WM) { table = new DataTable(); table.Columns.Add("Type", typeof(string)); table.Columns.Add("Direction", typeof(string)); table.Columns.Add("Distance", typeof(string)); table.Columns.Add("Solution", typeof(string)); foreach (string f in File.ReadAllLines(mydocpath)) { string[] words = f.Split('\\'); table.Rows.Add(words[0].ToString(), words[2].ToString(), words[4].ToString(), words[6].ToString()); } BackupToFile(); }
public LevelMatrix(WorldModel WM, float height, float width) : base(WM) { this.World_Width = width; this.World_Height = height; this.Matrix_Width = (int)width / WORLD_UNIT_SIZE; this.Matrix_Height = (int)height / WORLD_UNIT_SIZE; this.Matrix = new int[this.Matrix_Width, this.Matrix_Height]; for (int i = 0; i < Matrix_Width; i++) { for (int j = 0; j < Matrix_Height; j++) this.Matrix[i, j] = EMPTY; } //ConsolePrinter.PrintLine("World_Width: " + width + " | World_Height: " + height + " | Matrix_Width: " + this.Matrix_Width + " | Matrix_Height: " + this.Matrix_Height); }
public RectangleCharacter(WorldModel WM, float xPos, float yPos) : base(WM, xPos, yPos) { }
public Platform(WorldModel WM, int ID, float xPos, float yPos, float height, float width) : base(WM, xPos, yPos) { this.ID = ID; this.Width = width; this.Height = height; }
public Collectible(WorldModel WM, int id, float xPos, float yPos) : base(WM, xPos, yPos) { this.ID = id; }
public RectangleCharacter(WorldModel WM, float xPos, float yPos, float h) : base(WM, xPos, yPos) { this.heigth = h; }
public Connection(WorldModel WM, Point origin, Point destination) : base (WM) { this.Origin = origin; this.Destination = destination; }
public WorldObject(WorldModel WM) : base(WM) { }
public Platform(WorldModel WM, int ID, float xPos, float yPos, float height, float width) : base(WM, xPos, yPos) { this.ID = ID; this.Width = width; this.Height = height; }
public WorldObject(WorldModel WM, float x, float y) : base(WM) { this.xPos = x; this.yPos = y; }
public Point(WorldModel WM, int categorie, int side, float x, float y) : base(WM, x, y) { this.categorie = categorie; this.side = side; this.ConnectionList = new List<Connection>(); }
public Point(WorldModel WM, float x, float y) : base (WM, x, y) { this.ConnectionList = new List<Connection>(); }
public void Setup(int[] nI, float[] sI, float[] cI, float[] oI, float[] sPI, float[] cPI, float[] colI, Rectangle area, double timeLimit) { // Time limit is the time limit of the level - if negative then there is no time constrains this.area = area; int temp; // numbersInfo[] Description // // Index - Information // // 0 - Number of Obstacles // 1 - Number of Rectangle Platforms // 2 - Number of Circle Platforms // 3 - Number of Collectibles numbersInfo = new int[4]; int i; for (i = 0; i < nI.Length; i++) { numbersInfo[i] = nI[i]; } nCollectiblesLeft = nI[3]; // rectangleInfo[] Description // // Index - Information // // 0 - Rectangle X Position // 1 - Rectangle Y Position // 2 - Rectangle X Velocity // 3 - Rectangle Y Velocity // 4 - Rectangle Height rectangleInfo = new float[5]; rectangleInfo[0] = sI[0]; rectangleInfo[1] = sI[1]; rectangleInfo[2] = sI[2]; rectangleInfo[3] = sI[3]; rectangleInfo[4] = sI[4]; // circleInfo[] Description // // Index - Information // // 0 - Circle X Position // 1 - Circle Y Position // 2 - Circle X Velocity // 3 - Circle Y Velocity // 4 - Circle Radius circleInfo = new float[5]; circleInfo[0] = cI[0]; circleInfo[1] = cI[1]; circleInfo[2] = cI[2]; circleInfo[3] = cI[3]; circleInfo[4] = cI[4]; // Obstacles and Platforms Info Description // // X = Center X Coordinate // Y = Center Y Coordinate // // H = Platform Height // W = Platform Width // // Position (X=0,Y=0) = Left Superior Corner // obstaclesInfo[] Description // // Index - Information // // If (Number of Obstacles > 0) // [0 ; (NumObstacles * 4) - 1] - Obstacles' info [X,Y,H,W] // Else // 0 - 0 // 1 - 0 // 2 - 0 // 3 - 0 if (numbersInfo[0] > 0) obstaclesInfo = new float[numbersInfo[0] * 4]; else obstaclesInfo = new float[4]; temp = 1; if (nI[0] > 0) { while (temp <= nI[0]) { obstaclesInfo[(temp * 4) - 4] = oI[(temp * 4) - 4]; obstaclesInfo[(temp * 4) - 3] = oI[(temp * 4) - 3]; obstaclesInfo[(temp * 4) - 2] = oI[(temp * 4) - 2]; obstaclesInfo[(temp * 4) - 1] = oI[(temp * 4) - 1]; temp++; } } else { obstaclesInfo[0] = oI[0]; obstaclesInfo[1] = oI[1]; obstaclesInfo[2] = oI[2]; obstaclesInfo[3] = oI[3]; } // rectanglePlatformsInfo[] Description // // Index - Information // // If (Number of Rectangle Platforms > 0) // [0; (numRectanglePlatforms * 4) - 1] - Rectangle Platforms' info [X,Y,H,W] // Else // 0 - 0 // 1 - 0 // 2 - 0 // 3 - 0 if (numbersInfo[1] > 0) rectanglePlatformsInfo = new float[numbersInfo[1] * 4]; else rectanglePlatformsInfo = new float[4]; temp = 1; if (nI[1] > 0) { while (temp <= nI[1]) { rectanglePlatformsInfo[(temp * 4) - 4] = sPI[(temp * 4) - 4]; rectanglePlatformsInfo[(temp * 4) - 3] = sPI[(temp * 4) - 3]; rectanglePlatformsInfo[(temp * 4) - 2] = sPI[(temp * 4) - 2]; rectanglePlatformsInfo[(temp * 4) - 1] = sPI[(temp * 4) - 1]; temp++; } } else { rectanglePlatformsInfo[0] = sPI[0]; rectanglePlatformsInfo[1] = sPI[1]; rectanglePlatformsInfo[2] = sPI[2]; rectanglePlatformsInfo[3] = sPI[3]; } // circlePlatformsInfo[] Description // // Index - Information // // If (Number of Circle Platforms > 0) // [0; (numCirclePlatforms * 4) - 1] - Circle Platforms' info [X,Y,H,W] // Else // 0 - 0 // 1 - 0 // 2 - 0 // 3 - 0 if (numbersInfo[2] > 0) circlePlatformsInfo = new float[numbersInfo[2] * 4]; else circlePlatformsInfo = new float[4]; temp = 1; if (nI[2] > 0) { while (temp <= nI[2]) { circlePlatformsInfo[(temp * 4) - 4] = cPI[(temp * 4) - 4]; circlePlatformsInfo[(temp * 4) - 3] = cPI[(temp * 4) - 3]; circlePlatformsInfo[(temp * 4) - 2] = cPI[(temp * 4) - 2]; circlePlatformsInfo[(temp * 4) - 1] = cPI[(temp * 4) - 1]; temp++; } } else { circlePlatformsInfo[0] = cPI[0]; circlePlatformsInfo[1] = cPI[1]; circlePlatformsInfo[2] = cPI[2]; circlePlatformsInfo[3] = cPI[3]; } //Collectibles' To Catch Coordinates (X,Y) // // [0; (numCollectibles * 2) - 1] - Collectibles' Coordinates (X,Y) collectiblesInfo = new float[numbersInfo[3] * 2]; temp = 1; while (temp <= nI[3]) { collectiblesInfo[(temp * 2) - 2] = colI[(temp * 2) - 2]; collectiblesInfo[(temp * 2) - 1] = colI[(temp * 2) - 1]; temp++; } this.Model = new WorldModel(nI,sI, cI, oI, sPI, cPI, colI, area); this.CurrentRectangle = this.Model.Character; this.CurrentRectangle.heigth = sI[4]; this.PdA = new ProblemDectectionAlgorithm(this.Model); this.PdA.GeneratePoints(); this.PdA.GenerateConnections(); this.DMP = new DecisionMakingProcess(this.Model); DebugSensorsInfo(); }
public ProblemDectectionAlgorithm(WorldModel WM) { this.WM = WM; this.OpenPoints = new LeftPriorityList(); }