From 3af79eee31306e9d59604aa81b518dddb7672e0c Mon Sep 17 00:00:00 2001 From: aevrane <36012343+aevrane@users.noreply.github.com> Date: Fri, 9 Sep 2022 21:10:08 -0700 Subject: [PATCH] Create P.1 Intro And Neuron Code.cs --- Unity & C#/P.1 Intro And Neuron Code.cs | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Unity & C#/P.1 Intro And Neuron Code.cs diff --git a/Unity & C#/P.1 Intro And Neuron Code.cs b/Unity & C#/P.1 Intro And Neuron Code.cs new file mode 100644 index 0000000..8ba07bf --- /dev/null +++ b/Unity & C#/P.1 Intro And Neuron Code.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +public class Script1 : MonoBehaviour +{ + // Place this script on an empty Game Object and run. + + // Declare Variables + public float[] inputs; + public float[] weights; + public float bias; + public float output; + // Start is called before the first frame update + void Start() + { + //Set values of inputs, weights, and biases + inputs = new float[] { 1.2f, 5.1f, 2.1f }; + weights = new float[] { 3.1f, 2.1f, 8.7f }; + bias = 3; + } + + // Update is called once per frame + void Update() + { + // Update output every frame. Output will be displayed in the inspector for that Game Object. + output = inputs[0]*weights[0] + inputs[1]*weights[1] + inputs[2]*weights[2] + bias; + } +}