Exemple #1
0
    public void loadUp()
    {
        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      saveFile  = File.OpenRead("Assets/SavedNetworks/" + "playerMotion.xml");

        bestNN = (NNwnb)formatter.Deserialize(saveFile);
        saveFile.Close();
    }
Exemple #2
0
    public void save()
    {
        NNwnb bestNN = new NNwnb();

        bestNN.weightsNBiases    = gameObject.GetComponent <Evolver2>().returnBest();
        bestNN.inputNodes        = gameObject.GetComponent <Evolver2>().inputNodes;
        bestNN.outputNodes       = gameObject.GetComponent <Evolver2>().outputNodes;
        bestNN.hiddenLayersNodes = gameObject.GetComponent <Evolver2>().hiddenLayersNodes;
        bestNN.LayersNodes       = gameObject.GetComponent <Evolver2>().LayersNodes;

        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      saveFile  = File.Create("Assets/SavedNetworks/" + "playerMotion.xml");

        formatter.Serialize(saveFile, bestNN);
        saveFile.Close();
    }
Exemple #3
0
    public void load()
    {
        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      saveFile  = File.OpenRead("Assets/SavedNetworks/" + "playerMotion.xml");

        bestNN = (NNwnb)formatter.Deserialize(saveFile);
        saveFile.Close();

        playerBrain.inputNodes        = bestNN.inputNodes;
        playerBrain.outputNodes       = bestNN.outputNodes;
        playerBrain.hiddenLayersNodes = bestNN.hiddenLayersNodes;
        playerBrain.LayersNodes       = bestNN.LayersNodes;
        playerBrain.weightsNBiases    = bestNN.weightsNBiases[indexToUse];

        //Debug.Log(bestNN.inputNodes);
        //Debug.Log(bestNN.outputNodes);
    }