source: experiments/frams/capture-the-flag/data/scripts/FlagDef.neuro @ 496

Last change on this file since 496 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: 1.1 KB
RevLine 
[232]1class:
2name:FlagDef
3longname:Flag detection neuron
4description:Outputs signal strength
5prefinputs:0
6prefoutput:1
7icon:~
840,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~
9code:~
10function init(){
11//      Neuro.signals.add("Flag");
[480]12//      Neuro.signals[0].flavor = NeuroProperties.team;
[232]13//      Neuro.signals[0].power = 0;
14}
15
16function go()
17{
18        //Check own flag
[480]19        if (Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.my + 100, 0.5) > 0)
20                Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.my + 100, 0.5);
[232]21        //Check opponent flag
22        //If flag is taken -> go to own flag
[480]23        else if (Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.opp + 100, 0.5) > 0)
24                Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.my, 0.5);
[232]25        //else -> go to opponent flag
26        else
[480]27                Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.opp, 0.5);
[232]28}
29~
30
[480]31property:
[232]32id:opp
33name:Opponent team number
34type:d
35
[480]36property:
[232]37id:my
38name:My team number
39type:d
Note: See TracBrowser for help on using the repository browser.