Changeset 479 for experiments/frams
- Timestamp:
- 03/25/16 00:28:50 (9 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r476 r479 23 23 code:~ 24 24 25 25 global chambers; 26 global colors; 27 global dir_change; 28 global max_chamber_volume; 29 global movePerStep; 26 30 global nutrientenergywaiting; 31 global o; 27 32 global reprocounter; 28 global colors;29 global chambers;30 global o;31 global max_chamber_energ;32 global dir_change;33 global movePerStep;34 33 35 34 @include "foraminifera.inc" … … 83 82 84 83 //time 85 ExpParams.secPerStep = 60;84 ExpParams.secPerStep = 480; 86 85 ExpParams.foramSpeedMmPerMin = 0.05; 87 86 movePerStep = getMovePerStep(); … … 92 91 93 92 //reproduction 94 ExpParams.foramPop = 10;93 ExpParams.foramPop = 4; 95 94 ExpParams.crossprob = 0; 96 95 ExpParams.mutationprob = 0; 97 ExpParams.repro_time = 20; 96 ExpParams.repro_time = 720; 97 ExpParams.gametoPeriod = 43200; 98 ExpParams.divisionCost = 15.6; 98 99 reprocounter = 0; 100 101 init_chambers(); 99 102 100 103 //morphology … … 102 105 ExpParams.zone1_range = micronsToFrams(1000); 103 106 ExpParams.zone2_range = micronsToFrams(3000); 104 init_chambers(); 107 ExpParams.chamber_growth_time = 720; 108 ExpParams.chamberCostPerSec = 0.000001; 105 109 ExpParams.chamber_proculus_haplo = micronsToFrams(50); 106 110 ExpParams.chamber_difference_haplo = 0.0; 107 111 ExpParams.chamber_proculus_diplo = micronsToFrams(20); 108 112 ExpParams.chamber_difference_diplo = 0.2; 109 max_chamber_energ = [Vector.new(), Vector.new()]; 113 114 max_chamber_volume = [Vector.new(), Vector.new()]; 110 115 for (var j = 0; j < 2; j++) 111 116 { 112 117 for (var i = 0; i < chambers[0].size; i++) 113 118 { 114 max_chamber_ energ[j].add(((energyFromVolume(getProperty(j, "chamber_proculus")) + energyFromVolume(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference")))*(i+1))/2);119 max_chamber_volume[j].add(((volumeInMicrons(getProperty(j, "chamber_proculus")) + volumeInMicrons(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference")))*(i+1))/2); 115 120 } 116 121 } … … 120 125 ExpParams.min_repro_energ_diplo = 6; 121 126 122 ExpParams.e_meta = 0.00005; 123 ExpParams.energy_hib = 0.000025; 124 ExpParams.energy_move = 0.00005; 125 126 ExpParams.energies0_haplo = max_chamber_energ[0][0] - 0.001*max_chamber_energ[0][0]; 127 ExpParams.energies0_diplo = max_chamber_energ[1][0] - 0.001*max_chamber_energ[1][0]; 128 ExpParams.feedtrans = 0.125; 129 ExpParams.e_repro_cost_haplo = 0.7; 130 ExpParams.e_repro_cost_diplo = 0.3; 127 ExpParams.e_meta = 0.0000005; 128 ExpParams.energy_hib = 0.0000001; 129 ExpParams.energy_move = 0.0000005; 130 131 ExpParams.energies0_haplo = energyFromVolume(ExpParams.chamber_proculus_haplo,1); 132 ExpParams.energies0_diplo = energyFromVolume(micronsToFrams(1.25),1); 133 ExpParams.feedtrans = 0.001; 134 ExpParams.e_repro_cost_haplo = 0.3; 135 ExpParams.e_repro_cost_diplo = 0.2; 136 137 ExpParams.e_death_level_haplo = 0.5; 138 ExpParams.e_death_level_diplo = 0.5; 131 139 132 140 //nutrients 133 ExpParams.nutrientsize = micronsToFrams(10); 134 ExpParams.energy_nut = 100 * energyFromVolume(ExpParams.nutrientsize); 135 ExpParams.nutrientPop = 1; 136 ExpParams.feedrate = 100; 141 ExpParams.foodperiod = 480; 142 ExpParams.nutrientradius = micronsToFrams(10); 143 ExpParams.energy_nut = energyFromVolume(ExpParams.nutrientradius,1); 144 ExpParams.feedrate = 1; 145 ExpParams.ingestion = 0.25; 137 146 nutrientenergywaiting = 0; 138 147 ExpState.totaltestedcr = 0; … … 142 151 @include "standard_placement.inc" 143 152 144 function energyFromVolume(radius) 145 { 146 return 4.0/3.0*Math.pi*Math.pow(radius,3); 153 function volumeInMicrons(radiusInFrams) 154 { 155 return 4.0/3.0*Math.pi*Math.pow(framsToMicrons(radiusInFrams),3); 156 } 157 158 function energyFromVolume(base, isRadiusInFrams) 159 { 160 if (isRadiusInFrams == 1) //radius in frams 161 { 162 return ExpParams.picoCarbonPerMikro*volumeInMicrons(base); 163 } 164 else //volume in microns 165 { 166 return ExpParams.picoCarbonPerMikro * base; 167 } 147 168 } 148 169 … … 169 190 } 170 191 171 function add InitialForam(species, i)172 { 173 var geno = createForamGenotype( 0, species, 0);192 function addForam(species, iter, chambernum, ploid) 193 { 194 var geno = createForamGenotype(ploid, species, chambernum); 174 195 var cr = Populations[0].add(geno); 175 cr.name = "Initial creature" + species + "_" + i ;196 cr.name = "Initial creature" + species + "_" + iter; 176 197 placeCreatureRandomly(cr, 0, 0); 177 cr.energy0 = getProperty(0, "energies0");198 cr.energy0 = energyFromVolume(max_chamber_volume[ploid][chambernum],0); 178 199 cr.energy = cr.energy0; 179 200 setGenotype({"opt" : 0, "cr" : cr, "species" : species}); 201 if (ploid == 1) 202 { 203 cr.data->lifeparams->gen = 1; 204 cr.data->genes = [cr.data->genes, cr.data->genes]; //TODO two different genes sets 205 } 206 } 207 208 function addInitialForam(species, iter) 209 { 210 var ploid = 0; 211 if (Math.rnd01 > 0.5) 212 { 213 ploid = 1; 214 } 215 //add new foram with random energy bewtween starting energy and reproduction treshold 216 addForam(species, iter, Math.rndUni(0,getProperty(ploid, "min_repro_energ")),ploid); 180 217 } 181 218 … … 261 298 // -------------------------------- foram begin ----------------------------------- 262 299 263 function setForamMeta(cr , gen)264 { 265 // cr.idleen = (ExpParams.e_meta * max_chamber_energ[gen][Math.min(lastChamberNum(cr), max_chamber_energ[gen].size-1)])*ExpParams.secPerStep;300 function setForamMeta(cr) 301 { 302 //percent of current energy 266 303 cr.idleen = (ExpParams.e_meta * cr.energy)*ExpParams.secPerStep; 267 304 } … … 272 309 } 273 310 311 function getZoneRange(cr, zone_num) 312 { 313 return ExpParams.["zone"+zone_num+"_range"]; 314 } 315 274 316 function onForamsBorn(cr) 275 317 { 276 setForamMeta(cr , 1);318 setForamMeta(cr); 277 319 if (ExpParams.visualize == 1) 278 320 { 279 var ret = Populations[2].add("//0\np:sh=3,sx=0.01,sy="+ ExpParams.zone1_range+",sz="+ExpParams.zone1_range+",ry=1.57,vr=1.0,1.0,1.0");321 var ret = Populations[2].add("//0\np:sh=3,sx=0.01,sy="+getZoneRange(cr,1)+",sz="+getZoneRange(cr,1)+",ry=1.57,vr=1.0,1.0,1.0"); 280 322 cr.data->reticulopodiacreature = ret; 281 323 } … … 322 364 setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : 2}); 323 365 cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z); 324 setForamMeta(cr2 , cr2.data->lifeparams->gen);366 setForamMeta(cr2); 325 367 326 368 if (visualization(cr)) … … 335 377 { 336 378 var p = cr.getMechPart(0); 337 var n = cr.signals.receiveSet("nutrient", ExpParams.zone2_range);379 var n = cr.signals.receiveSet("nutrient", getZoneRange(cr,2)); 338 380 339 381 //if signals are received find the source of the nearest … … 354 396 distvec.sub(p.pos); 355 397 dist = distvec.length; 356 if (dist < ExpParams.zone1_range)398 if (dist < getZoneRange(cr,1)) 357 399 { 358 400 if (n[i].value != null) … … 390 432 if (cr.data->lifeparams->hibernated == 0) 391 433 { 392 // cr.energy_m += (ExpParams.energy_move * max_chamber_energ[cr.data->lifeparams->gen][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.data->lifeparams->gen].size)-1)])*ExpParams.secPerStep;393 cr.energy_m += (ExpParams.energy_move * cr. energy)*ExpParams.secPerStep;434 //percent of maximal energy 435 cr.energy_m += (ExpParams.energy_move * cr.data->lifeparams->max_energy_level)*ExpParams.secPerStep; 394 436 } 395 437 } … … 422 464 } 423 465 //random move 424 else if (cr.lifespan% (dir_change/ExpParams.secPerStep) == 0)466 else if (cr.lifespan%int(dir_change/ExpParams.secPerStep) == 0) 425 467 { 426 468 cr.data->lifeparams->dir = randomDir(); … … 445 487 { 446 488 cr1.localDrive = XYZ.new(0,0,0); 447 var e = ExpParams.feedtrans*ExpParams.secPerStep; //TODO efficiency dependent on age 448 e = Math.min(cr2.energy, e) + 0.0000001; 449 //Simulator.print("transferring "+e+" to "+cr1.name+" from "+cr2.name+" ("+cr2.energy+")"); 450 cr2.energy_m = cr2.energy_m + e; 451 cr1.energy_p = cr1.energy_p + e; 489 var e = ExpParams.feedtrans*cr1.energy;//ExpParams.feedtrans*cr1.energy*ExpParams.ingestion*ExpParams.secPerStep; //TODO efficiency dependent on age 490 e = Math.min(cr2.energy, e); 491 e *= ExpParams.secPerStep; 492 //Simulator.print("transferring "+e +"("+e*ExpParams.ingestion+")"+" to "+cr1.name +" ("+ cr1.energy+") " +" from "+cr2.name+" ("+cr2.energy+") "+ e/ExpParams.secPerStep+ " per sec"); 493 cr2.energy_m = cr2.energy_m + e + 0.0000001; 494 cr1.energy_p = cr1.energy_p + e*ExpParams.ingestion; 452 495 if (cr1.data->lifeparams->hibernated == 1) 453 496 { … … 460 503 if (cr.data->lifeparams->hibernated == 1) 461 504 { 462 setForamMeta(cr , cr.data->lifeparams->gen); //unhibernate505 setForamMeta(cr); //unhibernate 463 506 } 464 507 else 465 508 { 466 //cr.idleen = (ExpParams.energy_hib * max_chamber_energ[cr.data->lifeparams->gen][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.data->lifeparams->gen].size)-1)])*ExpParams.secPerStep; //hibernate467 509 cr.idleen = (ExpParams.energy_hib * cr.energy)*ExpParams.secPerStep; //hibernate 468 510 } … … 470 512 } 471 513 514 472 515 function onForamsStep(cr) 473 516 { 474 cr.getMechPart(0).orient.set(o); 475 if (visualization(cr)) 476 { 477 cr.data->reticulopodiacreature.moveAbs(cr.center_x-ExpParams.zone1_range, cr.center_y-ExpParams.zone1_range, cr.center_z-ExpParams.zone1_range-getProperty(cr.data->lifeparams->gen, "chamber_proculus")); 478 } 479 480 if (deathConditions(cr) == 1) 481 { 482 Populations[0].kill(cr); 483 return; 484 } 485 486 foramMove(cr); 487 488 var repro = foramReproduce(cr); 489 if (repro == 1) 490 { 491 return; 492 } 493 494 cr.data->lifeparams->max_energy_level = Math.max(cr.energy, cr.data->lifeparams->max_energy_level); 495 if (lastChamberNum(cr) <= chambers[0].size-1) 496 { 497 if ((cr.data->lifeparams->max_energy_level >= max_chamber_energ[cr.data->lifeparams->gen][lastChamberNum(cr)])) 498 { 499 foramGrow(cr, lastChamberNum(cr)); 500 } 517 //checking for gametogenesis process 518 if (cr.data->lifeparams->division_time > 0) 519 { 520 cr.data->lifeparams->division_time = Math.max(cr.data->lifeparams->division_time-1,0); 521 } 522 //checking for end of gametogenesis 523 else if (cr.data->lifeparams->division_time == 0) 524 { 525 //waiting for gamets fusion 526 } 527 //checking for chamber growth process 528 else if (cr.data->lifeparams->chamber_growth > 0) 529 { 530 cr.data->lifeparams->chamber_growth = Math.max(cr.data->lifeparams->chamber_growth-1,0); 531 //Simulator.print("chamber growing, time left = " + cr.data->lifeparams->chamber_growth*ExpParams.secPerStep); 532 cr.energy_m += ExpParams.chamberCostPerSec * cr.energy * ExpParams.secPerStep; 533 534 //Simulator.print("energy " + cr2.energy + " subtracting " + growth_cost); 535 } 536 //checking for end of chamber growth process 537 else if (cr.data->lifeparams->chamber_growth == 0) 538 { 539 foramGrow(cr, lastChamberNum(cr)); 540 cr.data->lifeparams->chamber_growth = -1; 541 //Simulator.print("chamber "+ (lastChamberNum(cr) + 1) +" complete"); 542 } 543 else 544 { 545 //update of metabolism rate 546 if (cr.data->lifeparams->hibernated == 0) 547 { 548 setForamMeta(cr); 549 } 550 551 cr.getMechPart(0).orient.set(o); 552 if (visualization(cr)) 553 { 554 cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1)-getProperty(cr.data->lifeparams->gen, "chamber_proculus")); 555 } 556 557 if (deathConditions(cr) == 1) 558 { 559 Populations[0].kill(cr); 560 return; 561 } 562 563 foramMove(cr); 564 565 var repro = foramReproduce(cr); 566 if (repro == 1) 567 { 568 return; 569 } 570 571 cr.data->lifeparams->max_energy_level = Math.max(cr.energy, cr.data->lifeparams->max_energy_level); 572 573 //cheking conditions of chamber growth process start 574 if (lastChamberNum(cr) != chambers[0].size-1) 575 { 576 if ((cr.data->lifeparams->max_energy_level >= energyFromVolume(max_chamber_volume[cr.data->lifeparams->gen][lastChamberNum(cr)],0))) 577 { 578 cr.data->lifeparams->chamber_growth = int(ExpParams.chamber_growth_time/ExpParams.secPerStep); 579 } 580 } 501 581 } 502 582 } … … 504 584 function deathConditions(cr) 505 585 { 506 if ((cr.energy <= getProperty(cr.data->lifeparams->species,"e_death_level")) || (Math.rnd01 < ExpParams.hunted_prob)) 586 if ((cr.energy <= getProperty(cr.data->lifeparams->gen,"e_death_level")*cr.data->lifeparams->max_energy_level) || (Math.rnd01 < ExpParams.hunted_prob)) 587 { 507 588 return 1; 589 } 508 590 else 509 591 return 0; … … 528 610 // -------------------------------- nutrient begin -------------------------------- 529 611 530 function createNutrientGenotype(nutrient size, zone1_range)531 { 532 return "//0\np:sh=3,sx="+nutrient size+",sy="+nutrientsize+",sz="+nutrientsize+",ry=1.5,vr=0.0,1.0,0.0";612 function createNutrientGenotype(nutrientradius) 613 { 614 return "//0\np:sh=3,sx="+nutrientradius+",sy="+nutrientradius+",sz="+nutrientradius+",ry=1.5,vr=0.0,1.0,0.0"; 533 615 } 534 616 … … 540 622 function addNutrient() 541 623 { 542 var cr = Populations[1].add(createNutrientGenotype(ExpParams.nutrient size, ExpParams.zone1_range));624 var cr = Populations[1].add(createNutrientGenotype(ExpParams.nutrientradius)); 543 625 544 626 cr.name = "Nutrients"; … … 553 635 if (ExpParams.visualize == 1) 554 636 { 555 var nutsize = ExpParams.nutrient size*10;637 var nutsize = ExpParams.nutrientradius*10; 556 638 var nut = Populations[2].add("//0\np:sh=2,sx="+nutsize+",sy="+nutsize+",sz="+nutsize+",ry=1.5,vr=0.0,1.0,0.0"); 557 639 cr.data->reticulopodiacreature = nut; … … 571 653 { 572 654 nutrientenergywaiting = nutrientenergywaiting + 1; 573 if (nutrientenergywaiting > ExpParams.feedrate/ExpParams.secPerStep)574 { 575 for (var i = 0; i < ExpParams. nutrientPop; i++)655 if (nutrientenergywaiting*ExpParams.secPerStep >= ExpParams.foodperiod) 656 { 657 for (var i = 0; i < ExpParams.feedrate*(ExpParams.secPerStep/ExpParams.foodperiod); i++) 576 658 { 577 659 addNutrient(); … … 668 750 669 751 // -------------------------------- step end -------------------------------- 752 //TODO default params values in frams instead of microns/seconds 670 753 671 754 @include "standard_events.inc" … … 692 775 693 776 prop: 777 id:gametSuccessRate 778 name:Ratio of successful gamets 779 type:f 0.001 780 group:Foraminifera 781 782 prop: 783 id:gametoPeriod 784 name:Time of gametogenesis 785 type:f 720 786 group:Foraminifera 787 788 prop: 789 id:picoCarbonPerMikro 790 name:Picograms of carbon in cubed micrometer 791 type:f 0.13 792 group:Foraminifera 793 794 prop: 694 795 id:secPerStep 695 796 name:Seconds per simulation step … … 705 806 706 807 prop: 808 id:divisionCost 809 name:Cost of division in pG 810 type:f 811 group:Foraminifera 812 813 prop: 707 814 id:e_repro_cost_diplo 708 815 name:Cost of reproduction 709 816 type:f 0.1 0.9 0.3 817 group:Foraminifera 818 819 prop: 820 id:chamber_growth_time 821 name:Time of the chamber growth in seconds 822 type:f 823 group:Foraminifera 824 825 prop: 826 id:chamberCostPerSec 827 name:Cost of growning chamber per second 828 type:f 710 829 group:Foraminifera 711 830 … … 791 910 id:e_death_level_haplo 792 911 name:Minimal level of energy to sustain life of haploid 793 type:f 0 20 4912 type:f 0 20 0.2 794 913 group:Foraminifera 795 914 … … 797 916 id:e_death_level_diplo 798 917 name:Minimal level of energy to sustain life of diploid 799 type:f 0 20 0.2 5918 type:f 0 20 0.2 800 919 group:Foraminifera 801 920 … … 857 976 858 977 prop: 978 id:ingestion 979 name:Ingestion rate 980 type:f 981 group:Energy 982 983 prop: 859 984 id:energy_nut 860 985 name:Nutrient energy 861 type:f 0 1000 986 type:f 0 100000 862 987 group:Energy 863 988 864 989 prop: 865 990 id:feedtrans 866 name: Ingestion multiplier867 type:f 0 100 991 name:Energy transfer per second 992 type:f 0 100000 868 993 group:Energy 869 994 870 995 prop: 871 id:nutrientsize 996 id:foodperiod 997 name:Time between food occurrences 998 type:f 0 100000 999 group:Energy 1000 1001 prop: 1002 id:nutrientradius 872 1003 name:Nutrient size 873 1004 type:f 0.1 0.9 0.1 874 1005 group:Energy 875 876 prop:877 id:nutrientPop878 name:Nutrient population size879 group:Energy880 type:d 1 1000 10881 1006 882 1007 prop: -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r476 r479 55 55 if (mode->opt == 0) //initial 56 56 { 57 mode->cr.data->genes = {"min_repro_energies" : [ max_chamber_energ[0][getProperty(0, "min_repro_energ")], max_chamber_energ[1][getProperty(1, "min_repro_energ")]], "hibernation" : mode->species};58 mode->cr.data->lifeparams = {"max_energy_level" : getProperty(0,"energies0"), "gen" : 0, "hibernated" : 0, "species" : mode->species, "reproduce" : 0, "dir" : randomDir() };57 mode->cr.data->genes = {"min_repro_energies" : [energyFromVolume(max_chamber_volume[0][getProperty(0, "min_repro_energ")],0), energyFromVolume(max_chamber_volume[1][getProperty(1, "min_repro_energ")],0)], "hibernation" : mode->species}; 58 mode->cr.data->lifeparams = {"max_energy_level" : getProperty(0,"energies0"), "gen" : 0, "hibernated" : 0, "species" : mode->species, "reproduce" : 0, "dir" : randomDir(), "chamber_growth" : -1, "division_time" : -1}; 59 59 } 60 60 else if (mode->opt == 1) //child 61 61 { 62 mode->cr.data->lifeparams = {"max_energy_level" : getProperty(1 - mode->parent_lifeparams->gen,"energies0"), "gen" : 1 - mode->parent_lifeparams->gen, "hibernated" : 0, "species" : mode->parent_lifeparams->species, "reproduce" : 0, "dir" : randomDir() };62 mode->cr.data->lifeparams = {"max_energy_level" : getProperty(1 - mode->parent_lifeparams->gen,"energies0"), "gen" : 1 - mode->parent_lifeparams->gen, "hibernated" : 0, "species" : mode->parent_lifeparams->species, "reproduce" : 0, "dir" : randomDir(), "chamber_growth" : -1, "division_time" : -1}; 63 63 mode->cr.data->genes = mode->parent_genes; 64 64 } … … 68 68 mode->cr.data->lifeparams = mode->parent_lifeparams; 69 69 } 70 } 71 72 function gametsDivision(parent_energy, energy0) 73 { 74 var number = 1; 75 var result = parent_energy; 76 while ((result-ExpParams.divisionCost) >= energy0) 77 { 78 result = (result-ExpParams.divisionCost)/2; 79 number *= 2; 80 } 81 //Simulator.print("parent: " + parent_energy + " result: " + result + " number " + number); 82 return {"energy" : result, "number" : number}; 70 83 } 71 84 … … 75 88 if (clone == 1) 76 89 { 77 energy0 = getProperty(0,"energies0"); 78 number = (( 1 - getProperty(1, "e_repro_cost")) * parent.energy) / energy0; 90 var offspring = gametsDivision(parent.energy,getProperty(0,"energies0")); 91 energy0 = offspring->energy; 92 number = offspring->number; 79 93 new_genes = parent.data->genes; 80 94 parent.data->lifeparams->gen = 1 - parent.data->lifeparams->gen; //because of reversal of "gen" in createOffspring function … … 83 97 else 84 98 { 85 energy0 = getProperty(1,"energies0"); 86 number = (((1 - getProperty(parent.data->lifeparams->gen, "e_repro_cost")) * parent.energy) + ((1 -(getProperty(parent.data->lifeparams->gen, "e_repro_cost"))) * parent2.energy)) / energy0; 99 var offspring1 = gametsDivision(parent.energy,getProperty(1,"energies0")); 100 var offspring2 = gametsDivision(parent2.energy,getProperty(1,"energies0")); 101 energy0 = (offspring1->energy+offspring2->energy); 102 number = ExpParams.gametSuccessRate*(offspring1->number+offspring2->number)/2; 87 103 new_genes = [parent.data->genes, parent2.data->genes]; 88 104 gen = 1 - parent.data->lifeparams->gen; … … 152 168 if (parent1 != null && parent2 != null) 153 169 { 154 reproduce_haploid(parent1, parent2, 0); 155 print_repro_info(parent1); 156 print_repro_info(parent2); 157 pop.kill(parent1); 158 pop.kill(parent2); 159 parent1 = null; 160 parent2 = null; 170 //when parents are ready for reproduction start gametogenesis 171 if (parent1.data->lifeparams->division_time == -1 && parent2.data->lifeparams->division_time == -1) 172 { 173 var time = int(ExpParams.gametoPeriod/ExpParams.secPerStep); 174 parent1.data->lifeparams->division_time = time; 175 parent2.data->lifeparams->division_time = time; 176 parent1.idleen = 0; 177 parent2.idleen = 0; 178 //Simulator.print("parents "+parent1.uid + " " + parent2.uid + " ready to repro: "+Simulator.stepNumber); 179 } 180 //when gametogenesis is finished fuse gamets 181 else if (parent1.data->lifeparams->division_time == 0 && parent2.data->lifeparams->division_time == 0) 182 { 183 reproduce_haploid(parent1, parent2, 0); 184 print_repro_info(parent1); 185 print_repro_info(parent2); 186 //Simulator.print("parents "+parent1.uid + " " + parent2.uid + " reproduced: "+Simulator.stepNumber); 187 pop.kill(parent1); 188 pop.kill(parent2); 189 parent1 = null; 190 parent2 = null; 191 192 } 161 193 } 162 194 }
Note: See TracChangeset
for help on using the changeset viewer.