Exemplo n.º 1
0
    public void Save(int poblationNum, int[] neuronalNetworkSize)
    {
        string path = SaveLoad.Instance.SaveDirectory + "NeuronalNetwork.json";

        NeuronalNetwork.SavedNeuronalNetwork[] savedNeuronalNetworks = new NeuronalNetwork.SavedNeuronalNetwork[poblationNum];
        for (int i = 0; i < poblation.Length; i++)
        {
            savedNeuronalNetworks[i] = poblation[i].GetComponent <DinoBehaviour>().SaveNeuronalNetwork();
        }
        SavedGeneration savedGen = new SavedGeneration(savedNeuronalNetworks, neuronalNetworkSize, poblationNum);
        string          save     = JsonUtility.ToJson(savedGen);

        File.WriteAllText(path, save);
    }
 public void LoadNeuronalNetwork(int[] initilLayers, NeuronalNetwork.SavedNeuronalNetwork save)
 {
     myNeuronalNetwork.LoadNeuronalnetwork(initilLayers, save);
 }