source:
experiments/frams/capture-the-flag/data/scripts/FlagDef.neuro
@
405
Last change on this file since 405 was 232, checked in by , 11 years ago | |
---|---|
File size: 1020 bytes |
Line | |
---|---|
1 | class: |
2 | name:FlagDef |
3 | longname:Flag detection neuron |
4 | description:Outputs signal strength |
5 | prefinputs:0 |
6 | prefoutput:1 |
7 | icon:~ |
8 | 40,3,3,25,0,25,100,75,50,25,0,1,75,50,100,50,11,30,50,38,50,40,48,42,52,44,47,46,48,48,57,50,42,52,52,54,47,57,50,65,50~ |
9 | code:~ |
10 | function init(){ |
11 | // Neuro.signals.add("Flag"); |
12 | // Neuro.signals[0].flavor = Fields.team; |
13 | // Neuro.signals[0].power = 0; |
14 | } |
15 | |
16 | function go() |
17 | { |
18 | //Check own flag |
19 | if (Neuro.signals.receiveFilter("Flag", 2000, Fields.my + 100, 0.5) > 0) |
20 | Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, Fields.my + 100, 0.5); |
21 | //Check opponent flag |
22 | //If flag is taken -> go to own flag |
23 | else if (Neuro.signals.receiveFilter("Flag", 2000, Fields.opp + 100, 0.5) > 0) |
24 | Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, Fields.my, 0.5); |
25 | //else -> go to opponent flag |
26 | else |
27 | Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, Fields.opp, 0.5); |
28 | } |
29 | ~ |
30 | |
31 | prop: |
32 | id:opp |
33 | name:Opponent team number |
34 | type:d |
35 | |
36 | prop: |
37 | id:my |
38 | name:My team number |
39 | type:d |
Note: See TracBrowser
for help on using the repository browser.