Пример #1
0
        //Map constructor
        public map(string mapSize, List <string> mapWall)
        {
            IntFromString ifs = new IntFromString(mapSize);

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

            width  = coordinate[0];
            length = coordinate[1];
            wall   = mapWall;
            drawMap();
        }
Пример #2
0
        //Robot constructor
        public robot(string initialState, string goalState, map map)
        {
            IntFromString ifs = new IntFromString(initialState);

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

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

            ifs = new IntFromString(goalState);

            coordinate = ifs.getIntFromString();

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

            robotMap = map;
        }
Пример #3
0
        //Draw obstacles
        public void drawWall(string oneWall)
        {
            IntFromString ifs        = new IntFromString(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);
                }
            }
        }