Beispiel #1
0
        public static void Test()
        {
            NuralData data = NuralData.Random(3, 3);

            DebugPrint(data.weights);

            SavingSystem.SaveData(data, "test.json");

            data = SavingSystem.GetData("test.json");

            DebugPrint(data.weights);
        }
    public void PrepareNewGeneration()
    {
        if (m_birds != null)
        {
            ImproveFromLastGeneration();
        }
        else
        {
            m_birds = new NuralControlBird[birdCount];

            if (preloadNuralData != "")
            {
                NuralData preloadData = SavingSystem.GetData(preloadNuralData);

                m_birds[0]      = Instantiate <NuralControlBird>(birdPrefab);
                m_birds[0].data = preloadData;

                for (int i = 1; i < birdCount; i++)
                {
                    m_birds[i]      = Instantiate <NuralControlBird>(birdPrefab);
                    m_birds[i].data = EvolveFromBaseData(preloadData);
                }
            }
            else
            {
                for (int i = 0; i < birdCount; i++)
                {
                    m_birds[i]      = Instantiate <NuralControlBird>(birdPrefab);
                    m_birds[i].data = NuralData.Random(6, 2);
                }
            }
        }

        m_generationCount       += 1;
        generationCountText.text = m_generationCount.ToString();
    }