Ejemplo n.º 1
0
    private void Restart()
    {
        float[]    BirdScore = new float[Birdnum];
        double[][] Weights   = new double[Birdnum][];

        string[] BirdTag = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
        for (int i = 0; i < Birdnum; i++)
        {
            Tm           = GameObject.FindGameObjectWithTag(BirdTag[i]).GetComponent <BirdController>();
            BirdScore[i] = Tm.ShowScore();
            Weights[i]   = Tm.GetOldWeights();
            Tm.Restart();
        }
        SortWeights(BirdScore, Weights);

        Learn(BirdScore, Weights);
        for (int i = 0; i < Birdnum; i++)
        {
            if (BirdScore[i] > Max)
            {
                Max = BirdScore[i];
                Debug.Log("The max score: " + Max);
            }

            Tm = GameObject.FindGameObjectWithTag(BirdTag[i]).GetComponent <BirdController>();

            Tm.SetNewWeights(Weights[i]);
        }
    }