public void loadUp() { BinaryFormatter formatter = new BinaryFormatter(); FileStream saveFile = File.OpenRead("Assets/SavedNetworks/" + "playerMotion.xml"); bestNN = (NNwnb)formatter.Deserialize(saveFile); saveFile.Close(); }
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(); }
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); }