source:
experiments/frams/capture-the-flag/data/scripts/threshold2.neuro
@
422
Last change on this file since 422 was 232, checked in by , 11 years ago | |
---|---|
File size: 966 bytes |
Line | |
---|---|
1 | class: |
2 | name:Thr2 |
3 | longname:Threshold 2 |
4 | description:~ |
5 | If (input>=t) then output=hi, else if (output<=-t) output=lo, else pass through. |
6 | |
7 | This is a modified Threshold neuron to use with a sample Capture The Flag battle. |
8 | This neuron passess signal without altering it in the range [-t, t]. |
9 | Outside of this range, the neuron outputs the truncated input. |
10 | This neuron is used to "steer" the food finder according to sensory inputs from left and right side.~ |
11 | prefinputs:-1 |
12 | prefoutput:1 |
13 | icon:~ |
14 | 24,3,3,25,0,25,100,75,50,25,0,1,75,50,100,50,3,30,75,40,75,40,40,60,40~ |
15 | code:~ |
16 | function init() |
17 | { |
18 | } |
19 | |
20 | function 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 | |
31 | prop: |
32 | id:t |
33 | name:threshold |
34 | type:f |
35 | |
36 | prop: |
37 | id:lo |
38 | name:low output value |
39 | type:f |
40 | |
41 | prop: |
42 | id:hi |
43 | name:high output value |
44 | type:f |
45 |
Note: See TracBrowser
for help on using the repository browser.