source: experiments/frams/capture-the-flag/data/scripts/threshold2.neuro @ 570

Last change on this file since 570 was 480, checked in by sz, 9 years ago

experiment scripts updated to match the upcoming Framsticks version (ExpParams? ==> ExpProperties?, Fields ==> NeuroProperties?, prop: ==> property)

File size: 1014 bytes
Line 
1class:
2name:Thr2
3longname:Threshold 2
4description:~
5If (input>=t) then output=hi, else if (output<=-t) output=lo, else pass through.
6
7This is a modified Threshold neuron to use with a sample Capture The Flag battle.
8This neuron passess signal without altering it in the range [-t, t].
9Outside of this range, the neuron outputs the truncated input.
10This neuron is used to "steer" the food finder according to sensory inputs from left and right side.~
11prefinputs:-1
12prefoutput:1
13icon:~
1424,3,3,25,0,25,100,75,50,25,0,1,75,50,100,50,3,30,75,40,75,40,40,60,40~
15code:~
16function init()
17{
18}
19
20function go()
21{
22  if (Neuro.weightedInputSum >= NeuroProperties.t)
23    Neuro.state = NeuroProperties.hi;
24  else if (Neuro.weightedInputSum <= -NeuroProperties.t)
25    Neuro.state = NeuroProperties.lo;
26  else
27    Neuro.state = Neuro.weightedInputSum;
28}
29~
30
31property:
32id:t
33name:threshold
34type:f
35
36property:
37id:lo
38name:low output value
39type:f
40
41property:
42id:hi
43name:high output value
44type:f
45
Note: See TracBrowser for help on using the repository browser.