Ignore:
Timestamp:
03/25/16 17:44:20 (9 years ago)
Author:
sz
Message:

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

Location:
experiments/frams/capture-the-flag/data/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • experiments/frams/capture-the-flag/data/scripts/Flag.neuro

    r232 r480  
    1010function init(){
    1111//      Neuro.signals.add("Flag");
    12 //      Neuro.signals[0].flavor = Fields.team;
     12//      Neuro.signals[0].flavor = NeuroProperties.team;
    1313//      Neuro.signals[0].power = 0;
    1414}
     
    1616function go()
    1717{
    18         var output = Neuro.signals.receiveFilter("Flag", 2000, Fields.team, 0.5);
     18        var output = Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.team, 0.5);
    1919        Neuro.state = output;
    2020       
     
    2222~
    2323
    24 prop:
     24property:
    2525id:team
    2626name:Team number
  • experiments/frams/capture-the-flag/data/scripts/FlagDef.neuro

    r232 r480  
    1010function init(){
    1111//      Neuro.signals.add("Flag");
    12 //      Neuro.signals[0].flavor = Fields.team;
     12//      Neuro.signals[0].flavor = NeuroProperties.team;
    1313//      Neuro.signals[0].power = 0;
    1414}
     
    1717{
    1818        //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);
     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);
    2121        //Check opponent flag
    2222        //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);
     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);
    2525        //else -> go to opponent flag
    2626        else
    27                 Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, Fields.opp, 0.5);
     27                Neuro.state = Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.opp, 0.5);
    2828}
    2929~
    3030
    31 prop:
     31property:
    3232id:opp
    3333name:Opponent team number
    3434type:d
    3535
    36 prop:
     36property:
    3737id:my
    3838name:My team number
  • experiments/frams/capture-the-flag/data/scripts/capture-the-flag.expdef

    r233 r480  
    2828        World.wrldbnd = 2; //Teleport
    2929       
    30         ExpParams.memberssno = 4;
    31         ExpParams.teamsno = 2;
    32         ExpParams.mindistance = 60;
     30        ExpProperties.memberssno = 4;
     31        ExpProperties.teamsno = 2;
     32        ExpProperties.mindistance = 60;
    3333       
    34         ExpParams.pointsCapture = 10;
    35         ExpParams.pointsRetrieve = 5;
    36         ExpParams.pointsScoring = 50;
     34        ExpProperties.pointsCapture = 10;
     35        ExpProperties.pointsRetrieve = 5;
     36        ExpProperties.pointsScoring = 50;
    3737
    3838        //Styles of flags
     
    5050function onExpInit()
    5151{
    52         ExpParams_create_call();
     52        ExpProperties_create_call();
    5353
    5454}
     
    8484}
    8585
    86 function ExpParams_create_call(){
     86function ExpProperties_create_call(){
    8787        //Create GenePool and Population for each team
    8888        GenePools.clear();
     
    106106       
    107107        var i = 2;
    108         for (i = 2; i <= ExpParams.teamsno; i++){
     108        for (i = 2; i <= ExpProperties.teamsno; i++){
    109109                pop=Populations.addGroup("Team"+i);
    110110                pop.selfmask = 0x50001;
     
    124124}
    125125
    126 function ExpParams_fill_call(){
     126function ExpProperties_fill_call(){
    127127        var team = 0;
    128128        var player = 0;
     
    141141        var ok = 0;
    142142       
    143         for (i = 0; i < ExpParams.teamsno; i++){
     143        for (i = 0; i < ExpProperties.teamsno; i++){
    144144                points.add(0);
    145145                scored.add(0);
     
    149149       
    150150        //Clear Populations
    151         for (team = 0; team < ExpParams.teamsno; team++){
     151        for (team = 0; team < ExpProperties.teamsno; team++){
    152152                while (Populations[team].size > 0)
    153153                        Populations[team].delete(0);
     
    162162
    163163                ok = 1;         
    164                 while (flagsX.size < ExpParams.teamsno && ok == 1){
     164                while (flagsX.size < ExpProperties.teamsno && ok == 1){
    165165                        ok = 0;
    166166                        flagTries = 0;
     
    171171                                ok = 1;
    172172                                for (i = 0; i < flagsX.size; i++){
    173                                         if (Math.sqrt(Math.pow(flagsX[i] - x, 2)+Math.pow(flagsY[i] - y,2)) < ExpParams.mindistance){
     173                                        if (Math.sqrt(Math.pow(flagsX[i] - x, 2)+Math.pow(flagsY[i] - y,2)) < ExpProperties.mindistance){
    174174                                                ok = 0;
    175175                                                break;
     
    185185                }
    186186               
    187                 if (flagsX.size == ExpParams.teamsno)
     187                if (flagsX.size == ExpProperties.teamsno)
    188188                        done = 1;
    189189                else
     
    199199       
    200200        //Fill each team's Population with players and a flag and place players close to their flag
    201         for (team = 0; team < ExpParams.teamsno; team++){
     201        for (team = 0; team < ExpProperties.teamsno; team++){
    202202                while (Populations[team].size > 0)
    203203                        Populations[team].delete(0);
    204204               
    205                 var cr = Populations[team].add(GenePools[ExpParams.teamsno][team]);
     205                var cr = Populations[team].add(GenePools[ExpProperties.teamsno][team]);
    206206                placeFlag(cr);
    207207                cr.signals.add("Flag");
     
    214214                var crX, crY;
    215215               
    216                 for (player = 0; player < ExpParams.memberssno; player++){
     216                for (player = 0; player < ExpProperties.memberssno; player++){
    217217                        var pool=GenePools[team];
    218218                        cr = Populations[team].add(pool[player % pool.size]);
     
    235235}
    236236
    237 function ExpParams_default_call(){
     237function ExpProperties_default_call(){
    238238        //Insert default player genotype in team's GenePools
    239239        var team = 0;
    240         for (team = 0; team < ExpParams.teamsno; team++){
     240        for (team = 0; team < ExpProperties.teamsno; team++){
    241241                while (GenePools[team].size > 0)
    242242                        GenePools[team].delete(0);
     
    272272//              line=line+Simulator.time+";";
    273273//             
    274 //              for (i = 0; i < ExpParams.teamsno; i++){
     274//              for (i = 0; i < ExpProperties.teamsno; i++){
    275275//                      line=line+points[i]+";"+scored[i]+";"+taken[i]+";"+retrieved[i]+";";
    276276//              }
     
    299299       
    300300        //Score points for taking a flag
    301         creature.user3 += ExpParams.pointsCapture;
     301        creature.user3 += ExpProperties.pointsCapture;
    302302       
    303303//      Simulator.print("Flag "+(flag.group.index+1)+" taken by team "+(creature.group.index+1));
    304304       
    305305        //Update team points and events
    306         points[creature.population.index] = points[creature.population.index] + ExpParams.pointsCapture;
     306        points[creature.population.index] = points[creature.population.index] + ExpProperties.pointsCapture;
    307307        taken[creature.population.index] = taken[creature.population.index] + 1;
    308308
     
    325325
    326326        //Score points for retrieving a flag
    327         creature.user3 += ExpParams.pointsRetrieve;
     327        creature.user3 += ExpProperties.pointsRetrieve;
    328328       
    329329//      Simulator.print("Flag "+ (flag.group.index+1) +" retrieved");
    330330       
    331331        //Update team scores
    332         points[creature.population.index] = points[creature.population.index] + ExpParams.pointsRetrieve;
     332        points[creature.population.index] = points[creature.population.index] + ExpProperties.pointsRetrieve;
    333333        retrieved[creature.population.index] = retrieved[creature.population.index] + 1;
    334334}
     
    346346       
    347347        //Score points for scoring a flag
    348         creature.user3 += ExpParams.pointsScoring;
     348        creature.user3 += ExpProperties.pointsScoring;
    349349       
    350350//      Simulator.print("Team "+ (creature.group.index + 1) +" scored");
    351351       
    352352        //Update team points
    353         points[creature.population.index] = points[creature.population.index] + ExpParams.pointsScoring;
     353        points[creature.population.index] = points[creature.population.index] + ExpProperties.pointsScoring;
    354354        scored[creature.population.index] = scored[creature.population.index] + 1;
    355355}
     
    419419~
    420420
    421 prop:
     421property:
    422422id:teamsno
    423423name:Number of teams
    424424type:d 2 5
    425425
    426 prop:
     426property:
    427427id:memberssno
    428428name:Number of members in team
    429429type:d 1 8
    430430
    431 prop:
     431property:
    432432id:mindistance
    433433name:Minimal distance between flags
    434434type:d 1 100
    435435
    436 prop:
     436property:
    437437id:create
    438438name:Create teams
    439439type:p
    440440
    441 prop:
     441property:
    442442id:default
    443443name:Insert default player
    444444type:p
    445445
    446 prop:
     446property:
    447447id:fill
    448448name:Fill teams
    449449type:p
    450450
    451 prop:
     451property:
    452452id:pointsCapture
    453453name:Points for flag capture
    454454type:d 0 100
    455455
    456 prop:
     456property:
    457457id:pointsRetrieve
    458458name:Points for flag retrieve
    459459type:d 0 100
    460460
    461 prop:
     461property:
    462462id:pointsScoring
    463463name:Points for scoring a flag
  • experiments/frams/capture-the-flag/data/scripts/threshold2.neuro

    r232 r480  
    2020function go()
    2121{
    22   if (Neuro.weightedInputSum >= Fields.t)
    23     Neuro.state = Fields.hi;
    24   else if (Neuro.weightedInputSum <= -Fields.t)
    25     Neuro.state = Fields.lo;
     22  if (Neuro.weightedInputSum >= NeuroProperties.t)
     23    Neuro.state = NeuroProperties.hi;
     24  else if (Neuro.weightedInputSum <= -NeuroProperties.t)
     25    Neuro.state = NeuroProperties.lo;
    2626  else
    2727    Neuro.state = Neuro.weightedInputSum;
     
    2929~
    3030
    31 prop:
     31property:
    3232id:t
    3333name:threshold
    3434type:f
    3535
    36 prop:
     36property:
    3737id:lo
    3838name:low output value
    3939type:f
    4040
    41 prop:
     41property:
    4242id:hi
    4343name:high output value
Note: See TracChangeset for help on using the changeset viewer.