Exemplo n.º 1
0
        private void CreateGUI(object o)
        {
            int width  = (int)((object[])o)[0];
            int height = (int)((object[])o)[1];
            int selfx  = (int)((object[])o)[2];
            int selfy  = (int)((object[])o)[3];
            int goalx  = (int)((object[])o)[4];
            int goaly  = (int)((object[])o)[5];
            Maze_With_No_Walls master = (Maze_With_No_Walls)((object[])o)[6];
            ManualResetEvent   w      = (ManualResetEvent)((object[])o)[7];

            master.maze = new MazeGUI_Example(width, height, selfx, selfy, goalx, goaly);
            w.Set();
            Application.Run(maze);
        }
Exemplo n.º 2
0
        public override Dictionary <QFeature, decimal> GetFeatures(QAction action)
        {
            Point              self       = ((Maze_With_No_Walls)GetNewState(action)).self;
            QSearch            qsearch    = new QSearch(this);
            Maze_With_No_Walls simpleMaze = new Maze_With_No_Walls()
            {
                maze = maze, self = self, goal = goal, width = width, height = height
            };
            QSearchResult bestPath = qsearch.AStar(simpleMaze);

            return(QFeature_String.FromStringDecimalDictionary(new Dictionary <string, decimal>()
            {
                //{this.GetHashCode().ToString()+"_"+action, 1}, // Identity to convert this back to QLearning
                { "Goal", goal == self? 1:0 },
                { "Distance_To_Goal", bestPath == null? 1:(decimal)bestPath.Count / (decimal)(width * height) },
            }));
        }
Exemplo n.º 3
0
        public override Dictionary<QFeature, decimal> GetFeatures(QAction action)
        {
            Point self = ((Maze_With_No_Walls)GetNewState(action)).self;
            QSearch qsearch = new QSearch(this);
            Maze_With_No_Walls simpleMaze = new Maze_With_No_Walls() { maze = maze, self = self, goal = goal, width = width, height = height };
            QSearchResult bestPath = qsearch.AStar(simpleMaze);

            return QFeature_String.FromStringDecimalDictionary(new Dictionary<string, decimal>() {
                //{this.GetHashCode().ToString()+"_"+action, 1}, // Identity to convert this back to QLearning
                {"Goal", goal==self? 1:0},
                {"Distance_To_Goal", bestPath==null? 1:(decimal) bestPath.Count / (decimal)(width * height)},
            });
        }