Beispiel #1
0
        public string solveCommand()
        {
            string  strSolve = model.solve("solve " + MazeNames.ToString() + " " + Properties.Settings.Default.SearchAlgorithm.ToString());
            JObject obj      = JObject.Parse(strSolve);
            string  strSol   = (string)obj["Solution"];

            return(strSol);
        }
        public void StartGame()
        {
            string strMaze = model.startCommand("start " + MazeNames.ToString() + " " + MazeRows.ToString() + " " + MazeCols.ToString());

            // convert the json to maze object
            // string strMaze = model.generateCommand();
            MyMaze = Maze.FromJSON(strMaze);
            // update properties
            MazeRows        = MyMaze.Rows;
            MazeCols        = MyMaze.Cols;
            MazeNames       = MyMaze.Name;
            InitialPosition = MyMaze.InitialPos;
            // update current position to the start point in maze
            CurrentPosition = MyMaze.InitialPos;
            EndPosition     = MyMaze.GoalPos;
        }