public Synapse(Neuron parentInput, Neuron childInput, float weightInput) { if (weightInput >= -1 && weightInput <= 1) { weight = weightInput; } else { weight = 0; } parentNeuron = parentInput; childNeuron = childInput; #if ENABLE_DISPLAY dispImage = new NetDisplayImage(); if (dispImage != null) { float r = 0; float g = 0; if (weight > 0) { g = weight; } else { r = weight * -1; } dispImage.displayColor = new Color(g, r, 0, .9f); } #endif }
public Synapse(Neuron parentInput, Neuron childInput) { weight = (float)Random.Range(-100, 101) / 100; parentNeuron = parentInput; childNeuron = childInput; #if ENABLE_DISPLAY dispImage = new NetDisplayImage(); if (dispImage != null) { float r = 0; float g = 0; if (weight > 0) { g = weight; } else { r = weight * -1; } dispImage.displayColor = new Color(g, r, 0, .9f); } #endif }
public void setSynapseImage(NetDisplayImage synapseImageInput) { dispImage = synapseImageInput; }