39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace NanoBrain {
|
|
|
|
/// <summary>
|
|
/// A Synapse connects the ouput of a Neuron to another Neuron
|
|
/// </summary>
|
|
[Serializable]
|
|
public class Synapse {
|
|
/// <summary>
|
|
/// The neuron from which input is received
|
|
/// </summary>
|
|
[SerializeReference]
|
|
public Neuron neuron;
|
|
|
|
/// <summary>
|
|
/// The weight value to apply to the Neuron input
|
|
/// </summary>
|
|
public float weight;
|
|
|
|
/// <summary>
|
|
/// Create a new Synapse
|
|
/// </summary>
|
|
/// <param name="nucleus">The neuron from which input is received</param>
|
|
/// <param name="weight">The weight value to apply to the Neuron input</param>
|
|
public Synapse(Neuron nucleus, float weight = 1.0f) {
|
|
this.neuron = nucleus;
|
|
this.weight = weight;
|
|
}
|
|
|
|
public bool isSleeping {
|
|
get {
|
|
return this.neuron.isSleeping;
|
|
}
|
|
}
|
|
}
|
|
|
|
} |