Changeset 480 for experiments/frams/capture-the-flag/data
- Timestamp:
- 03/25/16 17:44:20 (9 years ago)
- 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 10 10 function init(){ 11 11 // Neuro.signals.add("Flag"); 12 // Neuro.signals[0].flavor = Fields.team;12 // Neuro.signals[0].flavor = NeuroProperties.team; 13 13 // Neuro.signals[0].power = 0; 14 14 } … … 16 16 function go() 17 17 { 18 var output = Neuro.signals.receiveFilter("Flag", 2000, Fields.team, 0.5);18 var output = Neuro.signals.receiveFilter("Flag", 2000, NeuroProperties.team, 0.5); 19 19 Neuro.state = output; 20 20 … … 22 22 ~ 23 23 24 prop :24 property: 25 25 id:team 26 26 name:Team number -
experiments/frams/capture-the-flag/data/scripts/FlagDef.neuro
r232 r480 10 10 function init(){ 11 11 // Neuro.signals.add("Flag"); 12 // Neuro.signals[0].flavor = Fields.team;12 // Neuro.signals[0].flavor = NeuroProperties.team; 13 13 // Neuro.signals[0].power = 0; 14 14 } … … 17 17 { 18 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);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); 21 21 //Check opponent flag 22 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);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); 25 25 //else -> go to opponent flag 26 26 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); 28 28 } 29 29 ~ 30 30 31 prop :31 property: 32 32 id:opp 33 33 name:Opponent team number 34 34 type:d 35 35 36 prop :36 property: 37 37 id:my 38 38 name:My team number -
experiments/frams/capture-the-flag/data/scripts/capture-the-flag.expdef
r233 r480 28 28 World.wrldbnd = 2; //Teleport 29 29 30 ExpP arams.memberssno = 4;31 ExpP arams.teamsno = 2;32 ExpP arams.mindistance = 60;30 ExpProperties.memberssno = 4; 31 ExpProperties.teamsno = 2; 32 ExpProperties.mindistance = 60; 33 33 34 ExpP arams.pointsCapture = 10;35 ExpP arams.pointsRetrieve = 5;36 ExpP arams.pointsScoring = 50;34 ExpProperties.pointsCapture = 10; 35 ExpProperties.pointsRetrieve = 5; 36 ExpProperties.pointsScoring = 50; 37 37 38 38 //Styles of flags … … 50 50 function onExpInit() 51 51 { 52 ExpP arams_create_call();52 ExpProperties_create_call(); 53 53 54 54 } … … 84 84 } 85 85 86 function ExpP arams_create_call(){86 function ExpProperties_create_call(){ 87 87 //Create GenePool and Population for each team 88 88 GenePools.clear(); … … 106 106 107 107 var i = 2; 108 for (i = 2; i <= ExpP arams.teamsno; i++){108 for (i = 2; i <= ExpProperties.teamsno; i++){ 109 109 pop=Populations.addGroup("Team"+i); 110 110 pop.selfmask = 0x50001; … … 124 124 } 125 125 126 function ExpP arams_fill_call(){126 function ExpProperties_fill_call(){ 127 127 var team = 0; 128 128 var player = 0; … … 141 141 var ok = 0; 142 142 143 for (i = 0; i < ExpP arams.teamsno; i++){143 for (i = 0; i < ExpProperties.teamsno; i++){ 144 144 points.add(0); 145 145 scored.add(0); … … 149 149 150 150 //Clear Populations 151 for (team = 0; team < ExpP arams.teamsno; team++){151 for (team = 0; team < ExpProperties.teamsno; team++){ 152 152 while (Populations[team].size > 0) 153 153 Populations[team].delete(0); … … 162 162 163 163 ok = 1; 164 while (flagsX.size < ExpP arams.teamsno && ok == 1){164 while (flagsX.size < ExpProperties.teamsno && ok == 1){ 165 165 ok = 0; 166 166 flagTries = 0; … … 171 171 ok = 1; 172 172 for (i = 0; i < flagsX.size; i++){ 173 if (Math.sqrt(Math.pow(flagsX[i] - x, 2)+Math.pow(flagsY[i] - y,2)) < ExpP arams.mindistance){173 if (Math.sqrt(Math.pow(flagsX[i] - x, 2)+Math.pow(flagsY[i] - y,2)) < ExpProperties.mindistance){ 174 174 ok = 0; 175 175 break; … … 185 185 } 186 186 187 if (flagsX.size == ExpP arams.teamsno)187 if (flagsX.size == ExpProperties.teamsno) 188 188 done = 1; 189 189 else … … 199 199 200 200 //Fill each team's Population with players and a flag and place players close to their flag 201 for (team = 0; team < ExpP arams.teamsno; team++){201 for (team = 0; team < ExpProperties.teamsno; team++){ 202 202 while (Populations[team].size > 0) 203 203 Populations[team].delete(0); 204 204 205 var cr = Populations[team].add(GenePools[ExpP arams.teamsno][team]);205 var cr = Populations[team].add(GenePools[ExpProperties.teamsno][team]); 206 206 placeFlag(cr); 207 207 cr.signals.add("Flag"); … … 214 214 var crX, crY; 215 215 216 for (player = 0; player < ExpP arams.memberssno; player++){216 for (player = 0; player < ExpProperties.memberssno; player++){ 217 217 var pool=GenePools[team]; 218 218 cr = Populations[team].add(pool[player % pool.size]); … … 235 235 } 236 236 237 function ExpP arams_default_call(){237 function ExpProperties_default_call(){ 238 238 //Insert default player genotype in team's GenePools 239 239 var team = 0; 240 for (team = 0; team < ExpP arams.teamsno; team++){240 for (team = 0; team < ExpProperties.teamsno; team++){ 241 241 while (GenePools[team].size > 0) 242 242 GenePools[team].delete(0); … … 272 272 // line=line+Simulator.time+";"; 273 273 // 274 // for (i = 0; i < ExpP arams.teamsno; i++){274 // for (i = 0; i < ExpProperties.teamsno; i++){ 275 275 // line=line+points[i]+";"+scored[i]+";"+taken[i]+";"+retrieved[i]+";"; 276 276 // } … … 299 299 300 300 //Score points for taking a flag 301 creature.user3 += ExpP arams.pointsCapture;301 creature.user3 += ExpProperties.pointsCapture; 302 302 303 303 // Simulator.print("Flag "+(flag.group.index+1)+" taken by team "+(creature.group.index+1)); 304 304 305 305 //Update team points and events 306 points[creature.population.index] = points[creature.population.index] + ExpP arams.pointsCapture;306 points[creature.population.index] = points[creature.population.index] + ExpProperties.pointsCapture; 307 307 taken[creature.population.index] = taken[creature.population.index] + 1; 308 308 … … 325 325 326 326 //Score points for retrieving a flag 327 creature.user3 += ExpP arams.pointsRetrieve;327 creature.user3 += ExpProperties.pointsRetrieve; 328 328 329 329 // Simulator.print("Flag "+ (flag.group.index+1) +" retrieved"); 330 330 331 331 //Update team scores 332 points[creature.population.index] = points[creature.population.index] + ExpP arams.pointsRetrieve;332 points[creature.population.index] = points[creature.population.index] + ExpProperties.pointsRetrieve; 333 333 retrieved[creature.population.index] = retrieved[creature.population.index] + 1; 334 334 } … … 346 346 347 347 //Score points for scoring a flag 348 creature.user3 += ExpP arams.pointsScoring;348 creature.user3 += ExpProperties.pointsScoring; 349 349 350 350 // Simulator.print("Team "+ (creature.group.index + 1) +" scored"); 351 351 352 352 //Update team points 353 points[creature.population.index] = points[creature.population.index] + ExpP arams.pointsScoring;353 points[creature.population.index] = points[creature.population.index] + ExpProperties.pointsScoring; 354 354 scored[creature.population.index] = scored[creature.population.index] + 1; 355 355 } … … 419 419 ~ 420 420 421 prop :421 property: 422 422 id:teamsno 423 423 name:Number of teams 424 424 type:d 2 5 425 425 426 prop :426 property: 427 427 id:memberssno 428 428 name:Number of members in team 429 429 type:d 1 8 430 430 431 prop :431 property: 432 432 id:mindistance 433 433 name:Minimal distance between flags 434 434 type:d 1 100 435 435 436 prop :436 property: 437 437 id:create 438 438 name:Create teams 439 439 type:p 440 440 441 prop :441 property: 442 442 id:default 443 443 name:Insert default player 444 444 type:p 445 445 446 prop :446 property: 447 447 id:fill 448 448 name:Fill teams 449 449 type:p 450 450 451 prop :451 property: 452 452 id:pointsCapture 453 453 name:Points for flag capture 454 454 type:d 0 100 455 455 456 prop :456 property: 457 457 id:pointsRetrieve 458 458 name:Points for flag retrieve 459 459 type:d 0 100 460 460 461 prop :461 property: 462 462 id:pointsScoring 463 463 name:Points for scoring a flag -
experiments/frams/capture-the-flag/data/scripts/threshold2.neuro
r232 r480 20 20 function go() 21 21 { 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; 26 26 else 27 27 Neuro.state = Neuro.weightedInputSum; … … 29 29 ~ 30 30 31 prop :31 property: 32 32 id:t 33 33 name:threshold 34 34 type:f 35 35 36 prop :36 property: 37 37 id:lo 38 38 name:low output value 39 39 type:f 40 40 41 prop :41 property: 42 42 id:hi 43 43 name:high output value
Note: See TracChangeset
for help on using the changeset viewer.