Changeset 595 for experiments
- Timestamp:
- 08/23/16 21:28:36 (8 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r592 r595 323 323 } 324 324 325 function createAndRotate(geno, rotate_min, rotate_max, pop_num) 326 { 327 var cr = Populations[pop_num].add(geno); 328 cr.rotate(0,0,Math.rndUni(rotate_min, rotate_max)); 329 return cr; 330 } 331 332 //TODO unifiy addForam, foramGrow and createOffspring 325 333 function addForam(species, iter, start_energy, ploid) 326 334 { … … 329 337 var geno = create_genotype(radius, chambernum, colors[ploid], 1); 330 338 curColor = colors[ploid]; 331 var cr = Populations[0].add(geno);339 var cr = createAndRotate(geno, 0, 2*Math.pi, 0); 332 340 cr.name = "Initial creature" + species + "_" + iter; 333 341 placeRandomlyNotColliding(cr); … … 448 456 var ploid = cr.data->lifeparams->gen; 449 457 var geno = create_genotype(getPloidRadius(ploid), chamber_num+1, colors[ploid], lastchambergrowth); 450 var cr2 = Populations[0].add(geno); 451 458 var cr2 = createAndRotate(geno, 0, 0, 0); 459 460 cr2.orient.set(cr.orient); 452 461 cr2.energy0 = cr.energy; 453 462 cr2.energy = cr2.energy0; … … 507 516 function stepToNearest(cr) 508 517 { 509 var p = cr.getMechPart(0);518 var p = XYZ.new(cr.center_x, cr.center_y, cr.center_z); 510 519 var n = cr.signals.receiveSet("nutrient", getZoneRange(cr,2)); 511 520 … … 523 532 for (i = 0; i < n.size; i++) 524 533 { 525 mp = n[i].value.getMechPart(0);526 distvec.set(mp .pos);527 distvec.sub(p .pos);534 mp = XYZ.new(n[i].value.center_x, n[i].value.center_y, n[i].value.center_z); 535 distvec.set(mp); 536 distvec.sub(p); 528 537 dist = distvec.length; 529 538 if (dist < getZoneRange(cr,1)) … … 546 555 mindistvec.z = 0; 547 556 mindistvec.normalize(); 548 mindistvec.scale( -1*movePerStep);549 cr. localDrive = mindistvec;557 mindistvec.scale(movePerStep); 558 cr.drive = mindistvec; 550 559 moveEnergyDec(cr); 551 560 } … … 601 610 { 602 611 reverseHib(cr); 603 cr. localDrive = XYZ.new(0,0,0);612 cr.drive = XYZ.new(0,0,0); 604 613 } 605 614 //random move … … 608 617 cr.data->lifeparams->dir = randomDir(); 609 618 cr.data->lifeparams->dir_counter = 0; 610 cr. localDrive = cr.data->lifeparams->dir;619 cr.drive = cr.data->lifeparams->dir; 611 620 moveEnergyDec(cr); 612 621 } 613 622 else 614 623 { 615 cr. localDrive = cr.data->lifeparams->dir;624 cr.drive = cr.data->lifeparams->dir; 616 625 } 617 626 moveReticulopodia(cr); … … 623 632 { 624 633 cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1)); 625 cr.data->reticulopodiacreature. localDrive = cr.localDrive;634 cr.data->reticulopodiacreature.drive = cr.drive; 626 635 } 627 636 } … … 637 646 function energyTransfer(cr1, cr2) 638 647 { 639 cr1. localDrive = XYZ.new(0,0,0);648 cr1.drive = XYZ.new(0,0,0); 640 649 var e = ExpProperties.feedtrans*cr1.energy*ExpProperties.secPerStep; //TODO efficiency dependent on age 641 650 //Simulator.print("transferring "+e +"("+e*ExpProperties.ingestion+")"+" to "+cr1.name +" ("+ cr1.energy+") " +" from "+cr2.uid+" ("+cr2.energy+") "+ e/ExpProperties.secPerStep+ " per sec"); -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r593 r595 275 275 { 276 276 curColor = colors[1-parent_lifeparams->gen]; 277 var cr = Populations[0].add(geno);277 var cr = createAndRotate(geno, 0, 2*Math.pi, 0); 278 278 cr.energy0 = energy; 279 279 cr.energy = cr.energy0;
Note: See TracChangeset
for help on using the changeset viewer.