Esempio n. 1
0
        //Map constructor
        public worldMap(string mapSize, List <string> mapWall)
        {
            stringCon ifs = new stringCon(mapSize);

            List <int> coordinate = ifs.getIntFromString();

            width  = coordinate[0];
            length = coordinate[1];
            wall   = mapWall;
            drawMap();
        }
Esempio n. 2
0
        //Robot constructor
        public navigator(string initialState, string goalState, worldMap map)
        {
            stringCon ifs = new stringCon(initialState);

            List <int> coordinate = ifs.getIntFromString();

            pos = new posContain(coordinate[0], coordinate[1]);

            ifs = new stringCon(goalState);

            coordinate = ifs.getIntFromString();

            goalPos = new posContain(coordinate[0], coordinate[1]);

            robotMap = map;
        }
Esempio n. 3
0
        //Draw obstacles
        public void drawWall(string oneWall)
        {
            stringCon  ifs        = new stringCon(oneWall);
            List <int> coordinate = ifs.getIntFromString();

            for (int j = coordinate[1]; j < coordinate[1] + coordinate[3]; j++)
            {
                for (int i = coordinate[0]; i < coordinate[0] + coordinate[2]; i++)
                {
                    int index = grids.FindIndex(x => (x.Pos.X == i) && (x.Pos.Y == j));
                    grids[index].IsWall = true;
                }
            }

            foreach (grid g in grids)
            {
                if (g.IsWall == true)
                {
                    wallList.Add(g);
                }
            }
        }