Exemplo n.º 1
0
    } // end of update

    void resetAgents()
    {
        // restart prey
        timePrey.Add(timer);
        Destroy(prey);
        prey = Instantiate(preyprefab) as GameObject;
        Controller preyController = prey.GetComponent <Controller>();

        preyQlearning.setController(preyController);
        preyQlearning.resetMemory();
        preyQlearning.saveReward();
        preyController.stateArray = preyStateArray;
        preyController.qAlgorithm = preyQlearning;
        preyController.keyboard   = false;
        if (predatorsolo)
        {
            preyController.dummy = true;
        }

        // restart predator
        timePredator.Add(timer);
        Destroy(predator);
        predator = Instantiate(predatorprefab) as GameObject;
        Controller predatorController = predator.GetComponent <Controller>();

        predatorQlearning.setController(predatorController);
        predatorQlearning.resetMemory();
        predatorQlearning.saveReward();
        predatorController.stateArray = predatorStateArray;
        predatorController.qAlgorithm = predatorQlearning;
        if (preysolo)
        {
            predatorController.dummy = true;
        }

        counter += 1;
        timer    = 0; // reset timer
        Debug.Log("Run: " + (counter));

        savedRound = true;
    } // end of resetAgents
Exemplo n.º 2
0
    }     // end of update

    void resetAgents()
    {
        timePrey.Add(timer);
        Destroy(prey);
        prey = Instantiate(preyprefab) as GameObject;
        Controller preyController = prey.GetComponent <Controller>();

        preyQlearning.setController(preyController);
        preyQlearning.resetMemory();
        preyQlearning.saveReward();
        preyController.stateArray = preyStateArray;
        preyController.qAlgorithm = preyQlearning;

        if (eadible == null)
        {
            eadible = Instantiate(eadibleprefab) as GameObject;
        }

        timer    = 0;
        counter += 1;
    } // end of resetAgents