NetworkComposition Composition() { NetworkComposition composition = new NetworkComposition(sensors.sensors.Length, outputNodes); for (int i = 0; i < hiddenLayers.Count; i++) { composition.AddHiddenLayer(hiddenLayers[i]); } return(composition); }
public NeuralNetwork(NetworkComposition networkComposition, bool initDebugger, NeuralController controller) { this.networkComposition = networkComposition; SetupNetworkArchitecture(); score = 0; if (initDebugger) { networkDebugger = controller.gameObject.AddComponent(typeof(NeuralDebugger)) as NeuralDebugger; networkDebugger.Init(this, controller.nodeTexture, controller.targetCanvas); } }
void Start() { mixerConnected = false; vehicle = this.gameObject.GetComponent <Vehicle>(); sensors = GetComponent <Sensors>(); sensorInputs = new float[sensors.sensors.Length]; networkComposition = Composition(); neuralNetwork = new NeuralNetwork(networkComposition, true, this); bool mixerFound = FindAttachedMixer(this.gameObject); if (mixerFound) { mixerConnected = mixer.ConnectWithController(this, out mixer); mixer.Init(); } }