Exemplo n.º 1
0
    void Update()
    {
        // Set the correct filename and simulation speed
        fileName       = TrainingNetwork.ToString() + ".nn";
        Time.timeScale = simulationSpeed;

        // If a number of simulations are set
        if (NumOfSimulations > 0)
        {
            // Begin simulating
            count -= 1 * Time.deltaTime;

            // If intensively training, train the nodes
            if (intensiveTraining)
            {
                TrainNodes();
            }

            // If simulation time is up
            if (count <= 0)
            {
                NumOfSimulations--;

                // If there are still simulations remaining
                if (NumOfSimulations != 0)
                {
                    StartNewRound();
                }
                else
                {
                    // Exit the aplication
                    #if UNITY_EDITOR
                    UnityEditor.EditorApplication.isPlaying = false;
                    #else
                    Application.Quit();
                    #endif
                }
            }
        }
    }