Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (path == null && search.Finished())
     {
         Debug.Log("Visited: " + search.problem.GetVisited().ToString());
         Debug.Log("Expanded: " + search.problem.GetExpanded().ToString());
         path = search.GetActionPath();
         if (path != null)
         {
             Debug.Log("Path Length: " + path.Count.ToString());
             Debug.Log("[" + string.Join(",", path.ConvertAll <string> (Actions.ToString).ToArray()) + "]");
         }
     }
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            search.StartRunning();
        }

        if (path == null && search.Finished())
        {
            Debug.Log("Visited: " + search.problem.GetVisited().ToString());
            Debug.Log("Expanded: " + search.problem.GetExpanded().ToString());
            LOGGER.Log("Visited: {0}", search.problem.GetVisited().ToString());
            LOGGER.Log("Expanded: {0}", search.problem.GetExpanded().ToString());

            LOGGER.Log("Building solution path");
            path = search.GetActionPath();

            total_actions = path.Count;

            LOGGER.Log("Saving path!");
            savePath(path);

            LOGGER.Log("done.. !");
            LOGGER.Log("[{0}]", string.Join(",", path.ConvertAll <string> (Actions.ToString).ToArray()));

            if (path != null)
            {
                Debug.Log("Path Length (Number of Actions): " + path.Count.ToString());
                Debug.Log("[" + string.Join(",", path.ConvertAll <string> (Actions.ToString).ToArray()) + "]");
            }

            // if on batchmode terminate the application
            if (batchmode)
            {
                LOGGER.Log("Finished.");
                LOGGER.Flush();
                Application.Quit();
            }
        }

        visitedText.text  = "Visited: " + search.problem.GetVisited().ToString();
        expandedText.text = "Expanded: " + search.problem.GetExpanded().ToString();
        LOGGER.Flush();
    }