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

Last change on this file since 405 was 232, checked in by sz, 11 years ago

Capture The Flag game - http://www.framsticks.com/capture-the-flag

File size: 966 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 >= Fields.t)
23    Neuro.state = Fields.hi;
24  else if (Neuro.weightedInputSum <= -Fields.t)
25    Neuro.state = Fields.lo;
26  else
27    Neuro.state = Neuro.weightedInputSum;
28}
29~
30
31prop:
32id:t
33name:threshold
34type:f
35
36prop:
37id:lo
38name:low output value
39type:f
40
41prop:
42id:hi
43name:high output value
44type:f
45
Note: See TracBrowser for help on using the repository browser.