[380] | 1 | expdef:
|
---|
[406] | 2 | name:Reproduction of benthic foraminifera
|
---|
[380] | 3 | info:~
|
---|
[434] | 4 | Basic information about this simulation:
|
---|
| 5 | www.framsticks.com/foraminifera
|
---|
| 6 |
|
---|
| 7 | Technical information:
|
---|
[476] | 8 | Genes and parameter values which control reproduction are stored in data->genes and data->lifeparams fields.
|
---|
[380] | 9 |
|
---|
[476] | 10 | genes:
|
---|
[402] | 11 | genes which are not encoded in Ff genotype:
|
---|
[422] | 12 | min_repro_energy - Minimum energy necessary for reproduction
|
---|
| 13 | hibernation - Defines foram behavior in the case of no nutrients
|
---|
[380] | 14 |
|
---|
[476] | 15 | lifeparams:
|
---|
[380] | 16 | Physiological parameters of foraminifera:
|
---|
[422] | 17 | max_energy_level - maximum energy level reached so far
|
---|
[380] | 18 | gen - generation: 0 haploid, 1 diploid
|
---|
[432] | 19 | species - species: 0 not hibernating 1 hibernating
|
---|
| 20 | hibernated - 0/1 foram is/isn't hibernated
|
---|
[422] | 21 | reproduce - 0/1 foram isn't/is ready for reproduction
|
---|
[380] | 22 | ~
|
---|
| 23 | code:~
|
---|
| 24 |
|
---|
[479] | 25 | global chambers;
|
---|
[422] | 26 | global colors;
|
---|
[493] | 27 | global retColors;
|
---|
| 28 | global curColor;
|
---|
| 29 | global dir_change_sec;
|
---|
[479] | 30 | global max_chamber_volume;
|
---|
[474] | 31 | global movePerStep;
|
---|
[479] | 32 | global nutrientenergywaiting;
|
---|
| 33 | global o;
|
---|
| 34 | global reprocounter;
|
---|
[481] | 35 | global changePeriod;
|
---|
| 36 | global phase;
|
---|
[493] | 37 | global nutrientSqrCm;
|
---|
[487] | 38 | global species_genes;
|
---|
[380] | 39 |
|
---|
[406] | 40 | @include "foraminifera.inc"
|
---|
[401] | 41 |
|
---|
[380] | 42 | // -------------------------------- experiment begin --------------------------------
|
---|
| 43 |
|
---|
| 44 | function onExpDefLoad()
|
---|
| 45 | {
|
---|
| 46 | // define genotype and creature groups
|
---|
| 47 | GenePools.clear();
|
---|
| 48 | Populations.clear();
|
---|
| 49 | GenePools[0].name = "Unused";
|
---|
| 50 |
|
---|
| 51 | var pop = Populations[0];
|
---|
[421] | 52 | pop.name = "Forams";
|
---|
[380] | 53 | pop.en_assim = 0;
|
---|
[404] | 54 | pop.nnsim = 0;
|
---|
[380] | 55 | pop.enableperf = 1;
|
---|
| 56 | pop.death = 1;
|
---|
| 57 | pop.energy = 1;
|
---|
[487] | 58 | pop.selfmask = 0;
|
---|
| 59 | pop.othermask = 0;
|
---|
[401] | 60 | //pop.selfmask = 0x20002; pop.othermask = 0x10002;
|
---|
[422] | 61 | pop.perfperiod = 25;
|
---|
[487] | 62 | pop.bodysim = 0;
|
---|
[380] | 63 |
|
---|
[421] | 64 | pop = Populations.addGroup("Nutrients");
|
---|
[380] | 65 | pop.nnsim = 0;
|
---|
| 66 | pop.enableperf = 0;
|
---|
| 67 | pop.death = 1;
|
---|
| 68 | pop.energy = 1;
|
---|
[487] | 69 | pop.selfmask = 0;
|
---|
| 70 | pop.othermask = 0;
|
---|
[422] | 71 | //pop.othermask = 0x10002;
|
---|
[487] | 72 | pop.bodysim = 0;
|
---|
[380] | 73 |
|
---|
[444] | 74 | pop = Populations.addGroup("ReticulopodiaNutrients");
|
---|
[430] | 75 | pop.nnsim = 0;
|
---|
| 76 | pop.enableperf = 0;
|
---|
| 77 | pop.death = 0;
|
---|
| 78 | pop.energy = 0;
|
---|
[487] | 79 | pop.selfmask = 0;
|
---|
| 80 | pop.othermask = 0;
|
---|
| 81 | pop.bodysim = 0;
|
---|
[444] | 82 |
|
---|
[422] | 83 | //world
|
---|
| 84 | SignalView.mode = 1;
|
---|
[496] | 85 | World.wrldwat = 200;
|
---|
[493] | 86 | World.wrldsiz = micronsToFrams(100000);
|
---|
[422] | 87 | World.wrldbnd = 1;
|
---|
[486] | 88 | ExpProperties.stress = 1;
|
---|
| 89 | ExpProperties.creath = -0.99; //just above the bottom
|
---|
| 90 | ExpProperties.autorestart = 0;
|
---|
[422] | 91 |
|
---|
[474] | 92 | //time
|
---|
[486] | 93 | ExpProperties.secPerStep = 480;
|
---|
| 94 | ExpProperties.foramSpeedMmPerMin = 0.05;
|
---|
[474] | 95 | movePerStep = getMovePerStep();
|
---|
| 96 |
|
---|
[486] | 97 | //ExpProperties.visualize = 1; //uncomment to visualize reticulopodia and indicate nutrients positions
|
---|
[444] | 98 |
|
---|
[487] | 99 | //ExpProperties.logging = 1; //uncomment to enable logging simulation parameters to log files
|
---|
[493] | 100 | ExpProperties.logPref = "";
|
---|
[401] | 101 |
|
---|
[422] | 102 | //reproduction
|
---|
[486] | 103 | ExpProperties.foramPop = 20;
|
---|
| 104 | ExpProperties.crossprob = 0;
|
---|
| 105 | ExpProperties.mutationprob = 0;
|
---|
| 106 | ExpProperties.repro_time = 720;
|
---|
[493] | 107 | ExpProperties.gametoPeriod = 21600;
|
---|
[486] | 108 | ExpProperties.divisionCost = 15.6;
|
---|
[422] | 109 | reprocounter = 0;
|
---|
[380] | 110 |
|
---|
[487] | 111 | species_genes = [];
|
---|
| 112 |
|
---|
[479] | 113 | init_chambers();
|
---|
| 114 |
|
---|
[493] | 115 | curColor = retColors[0];
|
---|
[422] | 116 | //morphology
|
---|
[493] | 117 | dir_change_sec = 30000;
|
---|
[486] | 118 | ExpProperties.zone1_range = micronsToFrams(1000);
|
---|
| 119 | ExpProperties.zone2_range = micronsToFrams(3000);
|
---|
| 120 | ExpProperties.chamber_growth_time = 720;
|
---|
| 121 | ExpProperties.chamberCostPerSec = 0.000001;
|
---|
| 122 | ExpProperties.chamber_proculus_haplo = micronsToFrams(50);
|
---|
| 123 | ExpProperties.chamber_difference_haplo = 0.0;
|
---|
| 124 | ExpProperties.chamber_proculus_diplo = micronsToFrams(20);
|
---|
| 125 | ExpProperties.chamber_difference_diplo = micronsToFrams(8);
|
---|
[479] | 126 |
|
---|
| 127 | max_chamber_volume = [Vector.new(), Vector.new()];
|
---|
[422] | 128 | for (var j = 0; j < 2; j++)
|
---|
| 129 | {
|
---|
| 130 | for (var i = 0; i < chambers[0].size; i++)
|
---|
| 131 | {
|
---|
[479] | 132 | max_chamber_volume[j].add(((volumeInMicrons(getProperty(j, "chamber_proculus")) + volumeInMicrons(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference")))*(i+1))/2);
|
---|
[422] | 133 | }
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | //energetics
|
---|
[486] | 137 | ExpProperties.min_repro_energ_haplo = 4;
|
---|
| 138 | ExpProperties.min_repro_energ_diplo = 6;
|
---|
[430] | 139 |
|
---|
[486] | 140 | ExpProperties.e_meta = 0.0000005;
|
---|
| 141 | ExpProperties.energy_hib = 0.0000001;
|
---|
| 142 | ExpProperties.energy_move = 0.0000005;
|
---|
[430] | 143 |
|
---|
[493] | 144 | ExpProperties.energies0_haplo = 20;
|
---|
| 145 | ExpProperties.energies0_diplo = 1.25;
|
---|
[486] | 146 | ExpProperties.feedtrans = 0.001;
|
---|
| 147 | ExpProperties.e_repro_cost_haplo = 0.3;
|
---|
| 148 | ExpProperties.e_repro_cost_diplo = 0.2;
|
---|
[422] | 149 |
|
---|
[486] | 150 | ExpProperties.e_death_level_haplo = 0.5;
|
---|
| 151 | ExpProperties.e_death_level_diplo = 0.5;
|
---|
[479] | 152 |
|
---|
[422] | 153 | //nutrients
|
---|
[481] | 154 | changePeriod = 0;
|
---|
[488] | 155 | phase = "low";
|
---|
[493] | 156 | nutrientSqrCm = 10;
|
---|
[502] | 157 | ExpProperties.foodperiod = 19200;
|
---|
| 158 | ExpProperties.foodPeriodChange = 0;
|
---|
[486] | 159 | ExpProperties.nutrientradius = micronsToFrams(10);
|
---|
[524] | 160 | ExpProperties.energy_nut = 100 * energyFromVolume(ExpProperties.nutrientradius,1);
|
---|
[493] | 161 | ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz)*0.0001,2)/nutrientSqrCm;
|
---|
[486] | 162 | ExpProperties.ingestion = 0.25;
|
---|
[474] | 163 | nutrientenergywaiting = 0;
|
---|
[380] | 164 | ExpState.totaltestedcr = 0;
|
---|
[421] | 165 | ExpState.nutrient = "";
|
---|
[488] | 166 |
|
---|
[493] | 167 | //addSpecies({"min_repro_energies" : [4,6]});
|
---|
| 168 | //addSpecies({"min_repro_energies" : [4,8]});
|
---|
[380] | 169 | }
|
---|
| 170 |
|
---|
| 171 | @include "standard_placement.inc"
|
---|
| 172 |
|
---|
[479] | 173 | function volumeInMicrons(radiusInFrams)
|
---|
[475] | 174 | {
|
---|
[479] | 175 | return 4.0/3.0*Math.pi*Math.pow(framsToMicrons(radiusInFrams),3);
|
---|
[475] | 176 | }
|
---|
| 177 |
|
---|
[479] | 178 | function energyFromVolume(base, isRadiusInFrams)
|
---|
| 179 | {
|
---|
| 180 | if (isRadiusInFrams == 1) //radius in frams
|
---|
| 181 | {
|
---|
[486] | 182 | return ExpProperties.picoCarbonPerMikro*volumeInMicrons(base);
|
---|
[479] | 183 | }
|
---|
| 184 | else //volume in microns
|
---|
| 185 | {
|
---|
[486] | 186 | return ExpProperties.picoCarbonPerMikro * base;
|
---|
[479] | 187 | }
|
---|
| 188 | }
|
---|
| 189 |
|
---|
[474] | 190 | function getMovePerStep()
|
---|
| 191 | {
|
---|
[486] | 192 | return micronsToFrams((ExpProperties.foramSpeedMmPerMin/60)*1000)*ExpProperties.secPerStep;
|
---|
[474] | 193 | }
|
---|
| 194 |
|
---|
[447] | 195 | function micronsToFrams(micrometers)
|
---|
[422] | 196 | {
|
---|
[493] | 197 | return micrometers*0.01;
|
---|
[422] | 198 | }
|
---|
| 199 |
|
---|
[447] | 200 | function framsToMicrons(framsworldunits)
|
---|
[445] | 201 | {
|
---|
[493] | 202 | return framsworldunits/0.01;
|
---|
[445] | 203 | }
|
---|
| 204 |
|
---|
[422] | 205 | function getProperty(gen, prop_id)
|
---|
| 206 | {
|
---|
| 207 | var ploid = "haplo";
|
---|
| 208 | if (gen == 1) ploid = "diplo";
|
---|
[486] | 209 | return ExpProperties.[prop_id + "_" + ploid];
|
---|
[422] | 210 | }
|
---|
| 211 |
|
---|
[487] | 212 | function getGene(cr, gen_id, gen_set)
|
---|
| 213 | {
|
---|
| 214 | if (cr.data->lifeparams->gen == 0)
|
---|
| 215 | return cr.data->genes[gen_id];
|
---|
| 216 | else
|
---|
| 217 | return cr.data->genes[gen_set][gen_id];
|
---|
| 218 | }
|
---|
| 219 |
|
---|
[479] | 220 | function addForam(species, iter, chambernum, ploid)
|
---|
[422] | 221 | {
|
---|
[496] | 222 | var geno = createForamMorphology(ploid, ploid, chambernum);
|
---|
[493] | 223 | curColor = retColors[ploid];
|
---|
[422] | 224 | var cr = Populations[0].add(geno);
|
---|
[479] | 225 | cr.name = "Initial creature" + species + "_" + iter;
|
---|
[422] | 226 | placeCreatureRandomly(cr, 0, 0);
|
---|
[479] | 227 | cr.energy0 = energyFromVolume(max_chamber_volume[ploid][chambernum],0);
|
---|
[422] | 228 | cr.energy = cr.energy0;
|
---|
[487] | 229 | setGenotype({"opt" : 0, "cr" : cr, "species" : species, "energy0" : cr.energy0, "genes" : species_genes[species]});
|
---|
[479] | 230 | if (ploid == 1)
|
---|
| 231 | {
|
---|
| 232 | cr.data->lifeparams->gen = 1;
|
---|
| 233 | cr.data->genes = [cr.data->genes, cr.data->genes]; //TODO two different genes sets
|
---|
| 234 | }
|
---|
[525] | 235 | moveReticulopodia(cr);
|
---|
[422] | 236 | }
|
---|
| 237 |
|
---|
[479] | 238 | function addInitialForam(species, iter)
|
---|
| 239 | {
|
---|
| 240 | var ploid = 0;
|
---|
| 241 | if (Math.rnd01 > 0.5)
|
---|
| 242 | {
|
---|
| 243 | ploid = 1;
|
---|
| 244 | }
|
---|
[493] | 245 | //add new foram with random energy bewtween starting energy and reproduction threshold
|
---|
[488] | 246 | addForam(species, iter, int(Math.rndUni(0,species_genes[species]->min_repro_energies[ploid])),ploid);
|
---|
[479] | 247 | }
|
---|
| 248 |
|
---|
[487] | 249 | //new species can be added as a dictionary with parameter values that are different than default values
|
---|
| 250 | function addSpecies(new_genes)
|
---|
| 251 | {
|
---|
[493] | 252 | species_genes.add({"min_repro_energies" : [ExpProperties.min_repro_energ_haplo,ExpProperties.min_repro_energ_diplo], "energies0" : [ExpProperties.energies0_haplo, ExpProperties.energies0_diplo], "hibernation" : 0, "morphotype" : 0});
|
---|
[487] | 253 | for (var i = 0; i < new_genes.size; i++)
|
---|
| 254 | {
|
---|
| 255 | var key = new_genes.getKey(i);
|
---|
| 256 | species_genes[species_genes.size-1][key] = new_genes[key];
|
---|
| 257 | }
|
---|
| 258 | }
|
---|
| 259 |
|
---|
[380] | 260 | function onExpInit()
|
---|
| 261 | {
|
---|
| 262 | Populations[0].clear();
|
---|
| 263 | Populations[1].clear();
|
---|
[444] | 264 | Populations[2].clear(); //reticulopodia and nutrients
|
---|
[380] | 265 |
|
---|
[487] | 266 | if (species_genes.size == 0)
|
---|
[380] | 267 | {
|
---|
[487] | 268 | addSpecies({}); //default
|
---|
[380] | 269 | }
|
---|
[487] | 270 |
|
---|
| 271 | for (var spec = 0; spec < species_genes.size; spec++)
|
---|
| 272 | {
|
---|
| 273 | for (var i = 0; i < ExpProperties.foramPop; i++)
|
---|
| 274 | {
|
---|
| 275 | addInitialForam(spec, i);
|
---|
| 276 | }
|
---|
| 277 | }
|
---|
[422] | 278 | o = Populations[0][0].getMechPart(0).orient.clone();
|
---|
[380] | 279 | ExpState.totaltestedcr = 0;
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | function onExpLoad()
|
---|
| 283 | {
|
---|
| 284 | for (var pop in Populations)
|
---|
| 285 | pop.clear();
|
---|
| 286 |
|
---|
| 287 | Loader.addClass(sim_params.*);
|
---|
| 288 | Loader.setBreakLabel(Loader.BeforeUnknown, "onExpLoad_Unknown");
|
---|
| 289 | Loader.run();
|
---|
| 290 |
|
---|
[421] | 291 | Simulator.print("Loaded " + Populations[0].size + " Forams and " + Populations[1].size + " nutrient objects");
|
---|
[380] | 292 | }
|
---|
| 293 |
|
---|
| 294 | function onExpLoad_Unknown()
|
---|
| 295 | {
|
---|
| 296 | if (Loader.objectName == "org") // saved by the old expdef
|
---|
| 297 | {
|
---|
| 298 | var g = Genotype.newFromString("");
|
---|
| 299 | Loader.currentObject = g;
|
---|
| 300 | Interface.makeFrom(g).setAllDefault();
|
---|
| 301 | Loader.loadObject();
|
---|
| 302 | var cr = Populations[0].add(g);
|
---|
| 303 | if (cr != null)
|
---|
| 304 | {
|
---|
[401] | 305 | //cr.rotate(0,0,Math.rnd01*Math.twopi);
|
---|
[476] | 306 | if ((typeof(g.data->genes) == "Vector") && (g.data->genes.size >= 3))
|
---|
[401] | 307 | {
|
---|
| 308 | // [x,y,energy]
|
---|
[476] | 309 | cr.move(g.data->genes[0] - cr.center_x, g.data->genes[1] - cr.center_y, 0);
|
---|
| 310 | cr.energy = g.data->genes[2];
|
---|
[380] | 311 | }
|
---|
| 312 | else
|
---|
| 313 | {
|
---|
[401] | 314 | cr.move(Math.rnd01 * World.wrldsiz - cr.center_x, Math.rnd01 * World.wrldsiz - cr.center_y, 0);
|
---|
[380] | 315 | }
|
---|
| 316 | }
|
---|
| 317 | }
|
---|
| 318 | else if (Loader.objectName == "Creature")
|
---|
| 319 | {
|
---|
| 320 | Loader.currentObject = CreatureSnapshot.new();
|
---|
| 321 | Loader.loadObject();
|
---|
| 322 | Populations[0].add(Loader.currentObject);
|
---|
| 323 | }
|
---|
| 324 | }
|
---|
| 325 |
|
---|
| 326 | function onExpSave()
|
---|
| 327 | {
|
---|
| 328 | File.writeComment("saved by '%s.expdef'" % Simulator.expdef);
|
---|
| 329 |
|
---|
[401] | 330 | var tmpvec = [], i;
|
---|
[380] | 331 |
|
---|
[401] | 332 | for(var cr in Populations[1])
|
---|
[380] | 333 | tmpvec.add([cr.center_x, cr.center_y, cr.energy]);
|
---|
| 334 |
|
---|
[421] | 335 | ExpState.nutrient = tmpvec;
|
---|
[380] | 336 | File.writeObject(sim_params.*);
|
---|
[432] | 337 | ExpState.nutrient = null; //vectors are only created for saving and then discarded
|
---|
[380] | 338 |
|
---|
| 339 | for (var cr in Populations[0])
|
---|
| 340 | File.writeObject(cr);
|
---|
| 341 | }
|
---|
| 342 |
|
---|
| 343 | // -------------------------------- experiment end --------------------------------
|
---|
| 344 |
|
---|
[421] | 345 | // -------------------------------- foram begin -----------------------------------
|
---|
[380] | 346 |
|
---|
[479] | 347 | function setForamMeta(cr)
|
---|
[430] | 348 | {
|
---|
[479] | 349 | //percent of current energy
|
---|
[486] | 350 | cr.idleen = (ExpProperties.e_meta * cr.energy)*ExpProperties.secPerStep;
|
---|
[430] | 351 | }
|
---|
| 352 |
|
---|
| 353 | function lastChamberNum(cr)
|
---|
| 354 | {
|
---|
| 355 | return cr.numparts-1;
|
---|
| 356 | }
|
---|
| 357 |
|
---|
[479] | 358 | function getZoneRange(cr, zone_num)
|
---|
| 359 | {
|
---|
[486] | 360 | return ExpProperties.["zone"+zone_num+"_range"];
|
---|
[479] | 361 | }
|
---|
| 362 |
|
---|
[421] | 363 | function onForamsBorn(cr)
|
---|
| 364 | {
|
---|
[479] | 365 | setForamMeta(cr);
|
---|
[486] | 366 | if (ExpProperties.visualize == 1)
|
---|
[430] | 367 | {
|
---|
[506] | 368 | var ret = Populations[2].add("//0\nm:Vstyle=reticulopodia\np:sh=1,sx=0.001,sy=0.001,sz=0.001\np:sh=3,sx=0.01,sy="+getZoneRange(cr,1)+",sz="+getZoneRange(cr,1)+",ry=1.57079633,vr="+curColor+"\nj:0, 1, sh=1");
|
---|
[476] | 369 | cr.data->reticulopodiacreature = ret;
|
---|
[506] | 370 | ret.getMechPart(0).orient.set(cr.getMechPart(0).orient);
|
---|
[496] | 371 | ret.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));
|
---|
[430] | 372 | }
|
---|
[380] | 373 | }
|
---|
| 374 |
|
---|
[401] | 375 | function placeRandomlyNotColliding(cr)
|
---|
| 376 | {
|
---|
| 377 | var retry = 100; //try 100 times
|
---|
| 378 | while (retry--)
|
---|
| 379 | {
|
---|
| 380 | placeCreatureRandomly(cr, 0, 0);
|
---|
| 381 | if (!cr.boundingBoxCollisions(0))
|
---|
| 382 | return cr;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | Populations[0].delete(cr);
|
---|
| 386 | }
|
---|
| 387 |
|
---|
[444] | 388 | function visualization(cr)
|
---|
| 389 | {
|
---|
| 390 | var has_ret = 0;
|
---|
| 391 |
|
---|
[476] | 392 | if (cr.data->reticulopodiacreature != null)
|
---|
[444] | 393 | {
|
---|
[476] | 394 | if (Populations[2].findUID(cr.data->reticulopodiacreature.uid) != null)
|
---|
[444] | 395 | {
|
---|
| 396 | has_ret = 1;
|
---|
| 397 | }
|
---|
| 398 | }
|
---|
| 399 |
|
---|
| 400 | return has_ret;
|
---|
| 401 | }
|
---|
| 402 |
|
---|
[422] | 403 | function foramGrow(cr, chamber_num)
|
---|
[380] | 404 | {
|
---|
[476] | 405 | if ((chamber_num+1) < chambers[cr.data->lifeparams->species].size)
|
---|
[474] | 406 | {
|
---|
[493] | 407 | curColor = retColors[cr.data->lifeparams->gen];
|
---|
[496] | 408 | var geno = createForamMorphology(cr.data->lifeparams->gen, cr.data->lifeparams->gen, chamber_num+1);
|
---|
[474] | 409 | var cr2 = Populations[0].add(geno);
|
---|
[422] | 410 |
|
---|
[474] | 411 | cr2.energy0 = cr.energy;
|
---|
| 412 | cr2.energy = cr2.energy0;
|
---|
[422] | 413 |
|
---|
[487] | 414 | setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : 2, "energy0" : cr.energy0});
|
---|
[474] | 415 | cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z);
|
---|
[479] | 416 | setForamMeta(cr2);
|
---|
[422] | 417 |
|
---|
[474] | 418 | if (visualization(cr))
|
---|
| 419 | {
|
---|
[476] | 420 | Populations[2].delete(cr.data->reticulopodiacreature);
|
---|
[474] | 421 | }
|
---|
| 422 | Populations[0].delete(cr);
|
---|
[430] | 423 | }
|
---|
[380] | 424 | }
|
---|
| 425 |
|
---|
[435] | 426 | function stepToNearest(cr)
|
---|
[380] | 427 | {
|
---|
| 428 | var p = cr.getMechPart(0);
|
---|
[479] | 429 | var n = cr.signals.receiveSet("nutrient", getZoneRange(cr,2));
|
---|
[380] | 430 |
|
---|
[401] | 431 | //if signals are received find the source of the nearest
|
---|
[380] | 432 | if (n.size > 0)
|
---|
| 433 | {
|
---|
| 434 | var i;
|
---|
| 435 | var mp;
|
---|
| 436 | var distvec = XYZ.new(0, 0, 0);
|
---|
| 437 | var dist;
|
---|
[470] | 438 | var mindist = 100000000000.0;
|
---|
[380] | 439 | var mindistvec = null;
|
---|
[430] | 440 | var eating = 0;
|
---|
[380] | 441 |
|
---|
[401] | 442 | for (i = 0; i < n.size; i++)
|
---|
[380] | 443 | {
|
---|
[430] | 444 | mp = n[i].value.getMechPart(0);
|
---|
[401] | 445 | distvec.set(mp.pos);
|
---|
| 446 | distvec.sub(p.pos);
|
---|
| 447 | dist = distvec.length;
|
---|
[479] | 448 | if (dist < getZoneRange(cr,1))
|
---|
[380] | 449 | {
|
---|
[430] | 450 | if (n[i].value != null)
|
---|
| 451 | {
|
---|
| 452 | energyTransfer(cr, n[i].value);
|
---|
| 453 | eating = 1;
|
---|
| 454 | }
|
---|
| 455 | }
|
---|
[476] | 456 | else if (eating == 0 && cr.data->lifeparams->hibernated == 0 && dist < mindist)
|
---|
[430] | 457 | {
|
---|
[401] | 458 | mindist = dist;
|
---|
| 459 | mindistvec = distvec.clone();
|
---|
[380] | 460 | }
|
---|
| 461 | }
|
---|
| 462 |
|
---|
[476] | 463 | if (!eating && cr.data->lifeparams->hibernated == 0)
|
---|
[430] | 464 | {
|
---|
| 465 | mindistvec.normalize();
|
---|
[474] | 466 | mindistvec.scale(-1*movePerStep);
|
---|
[430] | 467 | cr.localDrive = mindistvec;
|
---|
| 468 | moveEnergyDec(cr);
|
---|
| 469 | }
|
---|
| 470 |
|
---|
[422] | 471 | return 1;
|
---|
[380] | 472 | }
|
---|
[422] | 473 |
|
---|
| 474 | else
|
---|
[474] | 475 | {
|
---|
[422] | 476 | return 0;
|
---|
[474] | 477 | }
|
---|
[422] | 478 | }
|
---|
[401] | 479 |
|
---|
[422] | 480 | function moveEnergyDec(cr)
|
---|
| 481 | {
|
---|
[476] | 482 | if (cr.data->lifeparams->hibernated == 0)
|
---|
[422] | 483 | {
|
---|
[479] | 484 | //percent of maximal energy
|
---|
[504] | 485 | cr.energy -= (ExpProperties.energy_move * cr.data->lifeparams->max_energy_level)*ExpProperties.secPerStep;
|
---|
[422] | 486 | }
|
---|
[421] | 487 | }
|
---|
[380] | 488 |
|
---|
[493] | 489 | function fence(pos, zone)
|
---|
[487] | 490 | {
|
---|
[496] | 491 | return Math.min(Math.max(0,pos),World.wrldsiz);
|
---|
[487] | 492 | }
|
---|
| 493 |
|
---|
[422] | 494 | function foramMove(cr)
|
---|
[421] | 495 | {
|
---|
[422] | 496 | //TODO moving inside sediment?
|
---|
[421] | 497 |
|
---|
[422] | 498 | //adjustment in z axis
|
---|
[493] | 499 | cr.moveAbs(fence(cr.pos_x, getZoneRange(cr, 1)), fence(cr.pos_y,getZoneRange(cr, 1)), 0);
|
---|
[421] | 500 |
|
---|
[430] | 501 | //are there any nutrients in zone 1 or 2?
|
---|
[401] | 502 | {
|
---|
[435] | 503 | var moved = stepToNearest(cr); //TODO weighted sum of distance and energy
|
---|
[422] | 504 | if (moved==1)
|
---|
[430] | 505 | {
|
---|
[502] | 506 | moveReticulopodia(cr);
|
---|
[422] | 507 | return;
|
---|
| 508 | }
|
---|
[401] | 509 | }
|
---|
| 510 |
|
---|
[422] | 511 | //no nutrients in zone 2
|
---|
[487] | 512 | if (getGene(cr, "hibernation",0) == 1)
|
---|
[401] | 513 | {
|
---|
[430] | 514 | reverseHib(cr);
|
---|
[422] | 515 | cr.localDrive = XYZ.new(0,0,0);
|
---|
[380] | 516 | }
|
---|
[422] | 517 | //random move
|
---|
[493] | 518 | else if (Simulator.stepNumber%int(dir_change_sec/ExpProperties.secPerStep) == 0)
|
---|
[380] | 519 | {
|
---|
[476] | 520 | cr.data->lifeparams->dir = randomDir();
|
---|
| 521 | cr.localDrive = cr.data->lifeparams->dir;
|
---|
[422] | 522 | moveEnergyDec(cr);
|
---|
| 523 | }
|
---|
[474] | 524 | else
|
---|
| 525 | {
|
---|
[476] | 526 | cr.localDrive = cr.data->lifeparams->dir;
|
---|
[474] | 527 | }
|
---|
[502] | 528 | moveReticulopodia(cr);
|
---|
[422] | 529 | }
|
---|
[401] | 530 |
|
---|
[502] | 531 | function moveReticulopodia(cr)
|
---|
| 532 | {
|
---|
| 533 | if (visualization(cr))
|
---|
| 534 | {
|
---|
| 535 | cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));
|
---|
| 536 | cr.data->reticulopodiacreature.localDrive = cr.localDrive;
|
---|
| 537 | }
|
---|
| 538 | }
|
---|
| 539 |
|
---|
[474] | 540 | function randomDir()
|
---|
| 541 | {
|
---|
[486] | 542 | var dir = (Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), 0);
|
---|
[474] | 543 | dir.normalize();
|
---|
| 544 | dir.scale(-1*movePerStep);
|
---|
| 545 | return dir;
|
---|
| 546 | }
|
---|
| 547 |
|
---|
[430] | 548 | function energyTransfer(cr1, cr2)
|
---|
[422] | 549 | {
|
---|
[430] | 550 | cr1.localDrive = XYZ.new(0,0,0);
|
---|
[510] | 551 | var e = ExpProperties.feedtrans*cr1.energy*ExpProperties.secPerStep; //TODO efficiency dependent on age
|
---|
[502] | 552 | //Simulator.print("transferring "+e +"("+e*ExpProperties.ingestion+")"+" to "+cr1.name +" ("+ cr1.energy+") " +" from "+cr2.uid+" ("+cr2.energy+") "+ e/ExpProperties.secPerStep+ " per sec");
|
---|
[510] | 553 | var transferred = cr2.transferEnergyTo(cr1, e);
|
---|
| 554 | cr1.energy -= transferred*(1-ExpProperties.ingestion);
|
---|
[476] | 555 | if (cr1.data->lifeparams->hibernated == 1)
|
---|
[422] | 556 | {
|
---|
[430] | 557 | reverseHib(cr1);
|
---|
[422] | 558 | }
|
---|
| 559 | }
|
---|
[401] | 560 |
|
---|
[430] | 561 | function reverseHib(cr)
|
---|
| 562 | {
|
---|
[476] | 563 | if (cr.data->lifeparams->hibernated == 1)
|
---|
[430] | 564 | {
|
---|
[479] | 565 | setForamMeta(cr); //unhibernate
|
---|
[430] | 566 | }
|
---|
| 567 | else
|
---|
| 568 | {
|
---|
[486] | 569 | cr.idleen = (ExpProperties.energy_hib * cr.energy)*ExpProperties.secPerStep; //hibernate
|
---|
[430] | 570 | }
|
---|
[476] | 571 | cr.data->lifeparams->hibernated = 1 - cr.data->lifeparams->hibernated;
|
---|
[430] | 572 | }
|
---|
| 573 |
|
---|
[493] | 574 | function createLogVector(cr, value)
|
---|
| 575 | {
|
---|
| 576 | var vec = Vector.new();
|
---|
| 577 | for (var i = 0; i < species_genes.size; i++)
|
---|
| 578 | {
|
---|
| 579 | for (var j = 0; j < 2; j++)
|
---|
| 580 | {
|
---|
| 581 | vec.add(0);
|
---|
| 582 | }
|
---|
| 583 | if (cr.data->lifeparams->species == i)
|
---|
| 584 | {
|
---|
| 585 | vec[i*2+cr.data->lifeparams->gen] = value;
|
---|
| 586 | }
|
---|
| 587 | }
|
---|
| 588 | return vec;
|
---|
| 589 | }
|
---|
[479] | 590 |
|
---|
[422] | 591 | function onForamsStep(cr)
|
---|
| 592 | {
|
---|
[479] | 593 | //checking for gametogenesis process
|
---|
| 594 | if (cr.data->lifeparams->division_time > 0)
|
---|
[444] | 595 | {
|
---|
[479] | 596 | cr.data->lifeparams->division_time = Math.max(cr.data->lifeparams->division_time-1,0);
|
---|
[444] | 597 | }
|
---|
[479] | 598 | //checking for end of gametogenesis
|
---|
| 599 | else if (cr.data->lifeparams->division_time == 0)
|
---|
[422] | 600 | {
|
---|
[479] | 601 | //waiting for gamets fusion
|
---|
[422] | 602 | }
|
---|
[479] | 603 | //checking for chamber growth process
|
---|
| 604 | else if (cr.data->lifeparams->chamber_growth > 0)
|
---|
| 605 | {
|
---|
| 606 | cr.data->lifeparams->chamber_growth = Math.max(cr.data->lifeparams->chamber_growth-1,0);
|
---|
[486] | 607 | //Simulator.print("chamber growing, time left = " + cr.data->lifeparams->chamber_growth*ExpProperties.secPerStep);
|
---|
[504] | 608 | cr.energy -= ExpProperties.chamberCostPerSec * cr.energy * ExpProperties.secPerStep;
|
---|
[422] | 609 |
|
---|
[479] | 610 | //Simulator.print("energy " + cr2.energy + " subtracting " + growth_cost);
|
---|
| 611 | }
|
---|
| 612 | //checking for end of chamber growth process
|
---|
| 613 | else if (cr.data->lifeparams->chamber_growth == 0)
|
---|
[430] | 614 | {
|
---|
[479] | 615 | foramGrow(cr, lastChamberNum(cr));
|
---|
| 616 | cr.data->lifeparams->chamber_growth = -1;
|
---|
| 617 | //Simulator.print("chamber "+ (lastChamberNum(cr) + 1) +" complete");
|
---|
[430] | 618 | }
|
---|
[479] | 619 | else
|
---|
[422] | 620 | {
|
---|
[479] | 621 | //update of metabolism rate
|
---|
| 622 | if (cr.data->lifeparams->hibernated == 0)
|
---|
[401] | 623 | {
|
---|
[479] | 624 | setForamMeta(cr);
|
---|
| 625 | }
|
---|
| 626 |
|
---|
| 627 | cr.getMechPart(0).orient.set(o);
|
---|
| 628 |
|
---|
| 629 | if (deathConditions(cr) == 1)
|
---|
| 630 | {
|
---|
[493] | 631 | if (ExpProperties.logging == 1)
|
---|
| 632 | {
|
---|
| 633 | log(createLogVector(cr, cr.data->lifeparams->max_energy_level),ExpProperties.logPref+"fossil_log.txt");
|
---|
| 634 | }
|
---|
[479] | 635 | Populations[0].kill(cr);
|
---|
| 636 | return;
|
---|
| 637 | }
|
---|
| 638 |
|
---|
| 639 | foramMove(cr);
|
---|
| 640 |
|
---|
| 641 | var repro = foramReproduce(cr);
|
---|
| 642 | if (repro == 1)
|
---|
| 643 | {
|
---|
| 644 | return;
|
---|
| 645 | }
|
---|
| 646 |
|
---|
| 647 | cr.data->lifeparams->max_energy_level = Math.max(cr.energy, cr.data->lifeparams->max_energy_level);
|
---|
| 648 |
|
---|
| 649 | //cheking conditions of chamber growth process start
|
---|
| 650 | if (lastChamberNum(cr) != chambers[0].size-1)
|
---|
| 651 | {
|
---|
| 652 | if ((cr.data->lifeparams->max_energy_level >= energyFromVolume(max_chamber_volume[cr.data->lifeparams->gen][lastChamberNum(cr)],0)))
|
---|
| 653 | {
|
---|
[486] | 654 | cr.data->lifeparams->chamber_growth = int(ExpProperties.chamber_growth_time/ExpProperties.secPerStep);
|
---|
[479] | 655 | }
|
---|
| 656 | }
|
---|
[430] | 657 | }
|
---|
[380] | 658 | }
|
---|
| 659 |
|
---|
[422] | 660 | function deathConditions(cr)
|
---|
| 661 | {
|
---|
[486] | 662 | if ((cr.energy <= getProperty(cr.data->lifeparams->gen,"e_death_level")*cr.data->lifeparams->max_energy_level) || (Math.rnd01 < ExpProperties.hunted_prob))
|
---|
[479] | 663 | {
|
---|
[422] | 664 | return 1;
|
---|
[479] | 665 | }
|
---|
[422] | 666 | else
|
---|
| 667 | return 0;
|
---|
| 668 | }
|
---|
| 669 |
|
---|
[421] | 670 | function onForamsDied(cr)
|
---|
[380] | 671 | {
|
---|
[444] | 672 | if (visualization(cr))
|
---|
[430] | 673 | {
|
---|
[476] | 674 | Populations[2].delete(cr.data->reticulopodiacreature);
|
---|
[430] | 675 | }
|
---|
[380] | 676 | //fossilization
|
---|
| 677 | var geno = GenePools[0].add(cr.genotype);
|
---|
[476] | 678 | geno.data->genes = cr.data->genes;
|
---|
| 679 | geno.data->lifeparams = cr.data->lifeparams;
|
---|
[486] | 680 | if (ExpProperties.logging == 1) Simulator.print("\"" + cr.name + "\" died...");
|
---|
[380] | 681 | ExpState.totaltestedcr++;
|
---|
| 682 | }
|
---|
| 683 |
|
---|
[421] | 684 | // --------------------------------foram end -------------------------------------
|
---|
[380] | 685 |
|
---|
[421] | 686 | // -------------------------------- nutrient begin --------------------------------
|
---|
[380] | 687 |
|
---|
[479] | 688 | function createNutrientGenotype(nutrientradius)
|
---|
[422] | 689 | {
|
---|
[524] | 690 | return "//0\nm:Vstyle=nutrient\np:sh=3,sx="+nutrientradius+",sy="+nutrientradius+",sz="+nutrientradius+",ry=1.57,vr=0.0,1.0,0.0";
|
---|
[422] | 691 | }
|
---|
| 692 |
|
---|
[421] | 693 | function onNutrientsStep(cr)
|
---|
[380] | 694 | {
|
---|
[444] | 695 | cr.moveAbs(cr.pos_x % World.wrldsiz, cr.pos_y % World.wrldsiz, 0.5);
|
---|
[380] | 696 | }
|
---|
| 697 |
|
---|
[421] | 698 | function addNutrient()
|
---|
[380] | 699 | {
|
---|
[486] | 700 | var cr = Populations[1].add(createNutrientGenotype(ExpProperties.nutrientradius));
|
---|
[380] | 701 |
|
---|
[421] | 702 | cr.name = "Nutrients";
|
---|
[380] | 703 | cr.idleen = 0;
|
---|
[486] | 704 | cr.energy0 = ExpProperties.energy_nut;
|
---|
[416] | 705 | cr.energy = cr.energy0;
|
---|
[421] | 706 | cr.signals.add("nutrient");
|
---|
[380] | 707 |
|
---|
[430] | 708 | cr.signals[0].value = cr;
|
---|
[380] | 709 |
|
---|
[422] | 710 | placeCreatureRandomly(cr, 0, 0);
|
---|
[486] | 711 | if (ExpProperties.visualize == 1)
|
---|
[444] | 712 | {
|
---|
[486] | 713 | var nutsize = ExpProperties.nutrientradius*10;
|
---|
[444] | 714 | 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");
|
---|
[476] | 715 | cr.data->reticulopodiacreature = nut;
|
---|
[444] | 716 | nut.moveAbs(cr.pos_x-1.5*nutsize, cr.pos_y-1.5*nutsize, 0.5);
|
---|
| 717 | }
|
---|
[380] | 718 | }
|
---|
| 719 |
|
---|
[444] | 720 | function onNutrientsDied(cr)
|
---|
| 721 | {
|
---|
| 722 | if (visualization(cr))
|
---|
| 723 | {
|
---|
[476] | 724 | Populations[2].delete(cr.data->reticulopodiacreature);
|
---|
[444] | 725 | }
|
---|
| 726 | }
|
---|
| 727 |
|
---|
[422] | 728 | function nutrientGrowth()
|
---|
[380] | 729 | {
|
---|
[486] | 730 | if (ExpProperties.foodPeriodChange > 0)
|
---|
[481] | 731 | {
|
---|
| 732 | changePeriod += 1;
|
---|
[486] | 733 | if (phase=="low" && (changePeriod*ExpProperties.secPerStep) >= 23328000) //9 months
|
---|
[481] | 734 | {
|
---|
[486] | 735 | ExpProperties.foodperiod = ExpProperties.foodperiod/ExpProperties.foodPeriodChange;
|
---|
[481] | 736 | phase = "high";
|
---|
| 737 | changePeriod = 0;
|
---|
| 738 | }
|
---|
| 739 |
|
---|
[486] | 740 | else if (phase == "high" && (changePeriod*ExpProperties.secPerStep) >= 7776000) //3 months
|
---|
[481] | 741 | {
|
---|
[486] | 742 | ExpProperties.foodperiod = ExpProperties.foodperiod*ExpProperties.foodPeriodChange;
|
---|
[481] | 743 | phase = "low";
|
---|
| 744 | changePeriod = 0;
|
---|
| 745 | }
|
---|
| 746 | }
|
---|
[474] | 747 | nutrientenergywaiting = nutrientenergywaiting + 1;
|
---|
[486] | 748 | if (nutrientenergywaiting*ExpProperties.secPerStep >= ExpProperties.foodperiod)
|
---|
[380] | 749 | {
|
---|
[493] | 750 | for (var i = 0; i < ExpProperties.nutrient_pop; i++)
|
---|
[432] | 751 | {
|
---|
[422] | 752 | addNutrient();
|
---|
| 753 | }
|
---|
| 754 |
|
---|
| 755 | nutrientenergywaiting = 0.0;
|
---|
| 756 | Simulator.checkpoint();
|
---|
[493] | 757 |
|
---|
| 758 | if (ExpProperties.logging == 1)
|
---|
| 759 | {
|
---|
| 760 | log([ExpProperties.nutrient_pop],ExpProperties.logPref+"nutrients_log.txt");
|
---|
| 761 | }
|
---|
[380] | 762 | }
|
---|
[493] | 763 |
|
---|
[380] | 764 | }
|
---|
| 765 |
|
---|
[421] | 766 | // -------------------------------- nutrient end --------------------------------
|
---|
[380] | 767 |
|
---|
[422] | 768 | // -------------------------------- step begin --------------------------------
|
---|
[380] | 769 |
|
---|
[422] | 770 | function onStep()
|
---|
| 771 | {
|
---|
[432] | 772 |
|
---|
| 773 | nutrientGrowth();
|
---|
[486] | 774 | if (ExpProperties.logging == 1)
|
---|
[422] | 775 | {
|
---|
| 776 | createStatistics();
|
---|
| 777 | }
|
---|
| 778 |
|
---|
| 779 | //reproduction --------------------------------------------
|
---|
| 780 | reprocounter += 1;
|
---|
[486] | 781 | if (reprocounter*ExpProperties.secPerStep > ExpProperties.repro_time)
|
---|
[422] | 782 | {
|
---|
| 783 | reprocounter = 0;
|
---|
| 784 | reproduce_parents(0);
|
---|
| 785 | reproduce_parents(1);
|
---|
| 786 | }
|
---|
| 787 |
|
---|
| 788 | //check for extinction -----------------------------------------------
|
---|
| 789 | if (Populations[0].size == 0)
|
---|
| 790 | {
|
---|
[486] | 791 | if (ExpProperties.autorestart)
|
---|
[422] | 792 | {
|
---|
| 793 | Simulator.print("no more creatures, restarting...");
|
---|
| 794 | onExpInit();
|
---|
| 795 | }
|
---|
| 796 | else
|
---|
| 797 | {
|
---|
| 798 | Simulator.print("no more creatures, stopped.");
|
---|
| 799 | Simulator.stop();
|
---|
| 800 | }
|
---|
| 801 | }
|
---|
[486] | 802 | if (ExpProperties.maxSteps > 0)
|
---|
[432] | 803 | {
|
---|
[486] | 804 | if (Simulator.stepNumber >= ExpProperties.maxSteps)
|
---|
[432] | 805 | Simulator.stop();
|
---|
| 806 | }
|
---|
[422] | 807 | }
|
---|
| 808 |
|
---|
| 809 | function createStatistics()
|
---|
| 810 | {
|
---|
[487] | 811 | var number = [];
|
---|
| 812 | var e_inc = [];
|
---|
[422] | 813 | var e_nut = 0.0;
|
---|
| 814 |
|
---|
[487] | 815 | for (var s = 0; s < species_genes.size; s++)
|
---|
| 816 | {
|
---|
| 817 | number.add([0,0]);// [haplo][diplo]
|
---|
| 818 | e_inc.add([0,0]);
|
---|
| 819 | }
|
---|
| 820 |
|
---|
[422] | 821 | for (var i = 0; i < Populations[0].size; i++)
|
---|
| 822 | {
|
---|
| 823 | var cr = Populations[0].get(i);
|
---|
[476] | 824 | var gen = cr.data->lifeparams->gen;
|
---|
| 825 | var species = cr.data->lifeparams->species;
|
---|
[430] | 826 |
|
---|
| 827 | number[species][gen] = number[species][gen] + 1;
|
---|
| 828 | e_inc[species][gen] = e_inc[species][gen] + cr.energy;
|
---|
[422] | 829 | }
|
---|
| 830 |
|
---|
| 831 | for (var i = 0; i < Populations[1].size; i++)
|
---|
| 832 | {
|
---|
| 833 | var cr = Populations[1].get(i);
|
---|
| 834 | e_nut += cr.energy;
|
---|
| 835 | }
|
---|
| 836 |
|
---|
[487] | 837 | var log_numbers = [];
|
---|
| 838 | var log_energies = [];
|
---|
[422] | 839 |
|
---|
[487] | 840 | for (var s = 0; s < species_genes.size; s++)
|
---|
| 841 | {
|
---|
| 842 | for (var p = 0; p < 2; p++)
|
---|
| 843 | {
|
---|
| 844 | log_numbers.add(number[s][p]);
|
---|
| 845 | log_energies.add(e_inc[s][p]);
|
---|
| 846 | }
|
---|
| 847 | }
|
---|
| 848 |
|
---|
| 849 | log_numbers.add(Populations[1].size);
|
---|
| 850 | log_energies.add(e_nut);
|
---|
| 851 |
|
---|
[493] | 852 | log(log_numbers, ExpProperties.logPref+"forams_log.txt");
|
---|
| 853 | log(log_energies, ExpProperties.logPref+"energies_log.txt");
|
---|
[422] | 854 | }
|
---|
| 855 |
|
---|
[380] | 856 | function log(tolog, fname)
|
---|
| 857 | {
|
---|
[430] | 858 | var f = File.appendDirect(fname, "forams data");
|
---|
[380] | 859 | f.writeString("" + Simulator.stepNumber);
|
---|
[401] | 860 | for (var i = 0; i < tolog.size; i++)
|
---|
[380] | 861 | {
|
---|
| 862 | f.writeString(";" + tolog[i]);
|
---|
| 863 | }
|
---|
| 864 | f.writeString("\n");
|
---|
| 865 | f.close();
|
---|
| 866 | }
|
---|
| 867 |
|
---|
[422] | 868 | // -------------------------------- step end --------------------------------
|
---|
[479] | 869 | //TODO default params values in frams instead of microns/seconds
|
---|
[380] | 870 |
|
---|
[401] | 871 | @include "standard_events.inc"
|
---|
[380] | 872 |
|
---|
[401] | 873 | ~
|
---|
[380] | 874 |
|
---|
[486] | 875 | property:
|
---|
[444] | 876 | id:visualize
|
---|
| 877 | name:Show reticulopodia and nutrients
|
---|
[430] | 878 | type:d 0 1 0
|
---|
| 879 | group:Foraminifera
|
---|
| 880 |
|
---|
[486] | 881 | property:
|
---|
[434] | 882 | id:maxSteps
|
---|
[432] | 883 | name:Stop after the given number of simulation steps
|
---|
[434] | 884 | type:d 0 1000000 0
|
---|
[432] | 885 |
|
---|
[486] | 886 | property:
|
---|
[493] | 887 | id:logPref
|
---|
| 888 | name:Log prefix
|
---|
| 889 | type:s
|
---|
| 890 |
|
---|
| 891 | property:
|
---|
[474] | 892 | id:foramSpeedMmPerMin
|
---|
| 893 | name:Speed of foraminfera in mm/min
|
---|
| 894 | type:f 0.1
|
---|
| 895 | flags: 16
|
---|
| 896 | group:Foraminifera
|
---|
| 897 |
|
---|
[486] | 898 | property:
|
---|
[479] | 899 | id:gametSuccessRate
|
---|
| 900 | name:Ratio of successful gamets
|
---|
| 901 | type:f 0.001
|
---|
| 902 | group:Foraminifera
|
---|
| 903 |
|
---|
[486] | 904 | property:
|
---|
[479] | 905 | id:gametoPeriod
|
---|
| 906 | name:Time of gametogenesis
|
---|
| 907 | type:f 720
|
---|
| 908 | group:Foraminifera
|
---|
| 909 |
|
---|
[486] | 910 | property:
|
---|
[479] | 911 | id:picoCarbonPerMikro
|
---|
| 912 | name:Picograms of carbon in cubed micrometer
|
---|
| 913 | type:f 0.13
|
---|
| 914 | group:Foraminifera
|
---|
| 915 |
|
---|
[486] | 916 | property:
|
---|
[474] | 917 | id:secPerStep
|
---|
| 918 | name:Seconds per simulation step
|
---|
[524] | 919 | help:Number of seconds of foraminifera time per simulation step
|
---|
[474] | 920 | type:f 60.0
|
---|
| 921 | flags: 16
|
---|
| 922 | group:Foraminifera
|
---|
| 923 |
|
---|
[486] | 924 | property:
|
---|
[422] | 925 | id:e_repro_cost_haplo
|
---|
[423] | 926 | name:Cost of reproduction
|
---|
[422] | 927 | type:f 0.1 0.9 0.5
|
---|
[421] | 928 | group:Foraminifera
|
---|
[380] | 929 |
|
---|
[486] | 930 | property:
|
---|
[479] | 931 | id:divisionCost
|
---|
| 932 | name:Cost of division in pG
|
---|
| 933 | type:f
|
---|
| 934 | group:Foraminifera
|
---|
| 935 |
|
---|
[486] | 936 | property:
|
---|
[422] | 937 | id:e_repro_cost_diplo
|
---|
[423] | 938 | name:Cost of reproduction
|
---|
[422] | 939 | type:f 0.1 0.9 0.3
|
---|
| 940 | group:Foraminifera
|
---|
[380] | 941 |
|
---|
[486] | 942 | property:
|
---|
[479] | 943 | id:chamber_growth_time
|
---|
| 944 | name:Time of the chamber growth in seconds
|
---|
| 945 | type:f
|
---|
| 946 | group:Foraminifera
|
---|
| 947 |
|
---|
[486] | 948 | property:
|
---|
[479] | 949 | id:chamberCostPerSec
|
---|
| 950 | name:Cost of growning chamber per second
|
---|
| 951 | type:f
|
---|
| 952 | group:Foraminifera
|
---|
| 953 |
|
---|
[486] | 954 | property:
|
---|
[422] | 955 | id:chamber_proculus_haplo
|
---|
[423] | 956 | name:Size of proculus
|
---|
[422] | 957 | type:f
|
---|
[421] | 958 | group:Foraminifera
|
---|
[380] | 959 |
|
---|
[486] | 960 | property:
|
---|
[422] | 961 | id:chamber_proculus_diplo
|
---|
[423] | 962 | name:Size of proculus
|
---|
[422] | 963 | type:f
|
---|
[380] | 964 | group:Foraminifera
|
---|
| 965 |
|
---|
[486] | 966 | property:
|
---|
[422] | 967 | id:chamber_difference_haplo
|
---|
[423] | 968 | name:Difference in size between subsequent chambers
|
---|
[422] | 969 | type:f
|
---|
[380] | 970 | group:Foraminifera
|
---|
| 971 |
|
---|
[486] | 972 | property:
|
---|
[422] | 973 | id:chamber_difference_diplo
|
---|
[423] | 974 | name:Difference in size between subsequent chambers
|
---|
[422] | 975 | type:f
|
---|
[380] | 976 | group:Foraminifera
|
---|
| 977 |
|
---|
[486] | 978 | property:
|
---|
[422] | 979 | id:hunted_prob
|
---|
| 980 | name:Probability of being hunted
|
---|
| 981 | type:f 0 1 0
|
---|
| 982 | group:Forminifera
|
---|
[380] | 983 |
|
---|
[486] | 984 | property:
|
---|
[422] | 985 | id:zone1_range
|
---|
| 986 | name:Zone 1 range
|
---|
| 987 | type:f 0 200
|
---|
| 988 | group:Foraminifera
|
---|
[380] | 989 |
|
---|
[486] | 990 | property:
|
---|
[422] | 991 | id:zone2_range
|
---|
| 992 | name:Zone 2 range
|
---|
| 993 | type:f 0 3000
|
---|
[421] | 994 | group:Foraminifera
|
---|
[380] | 995 |
|
---|
[486] | 996 | property:
|
---|
[422] | 997 | id:colors
|
---|
| 998 | name:Haploid and diploid colors
|
---|
| 999 | type:x
|
---|
[380] | 1000 | group:Foraminifera
|
---|
| 1001 |
|
---|
[486] | 1002 | property:
|
---|
[422] | 1003 | id:min_repro_energ_haplo
|
---|
| 1004 | name:Min reproduction energy of forams
|
---|
| 1005 | type:f
|
---|
[380] | 1006 | group:Foraminifera
|
---|
| 1007 |
|
---|
[486] | 1008 | property:
|
---|
[422] | 1009 | id:min_repro_energ_diplo
|
---|
| 1010 | name:Min reproduction energy of forams
|
---|
| 1011 | type:f
|
---|
| 1012 | group:Foraminifera
|
---|
| 1013 |
|
---|
[486] | 1014 | property:
|
---|
[380] | 1015 | id:repro_prob
|
---|
[401] | 1016 | name:Probability of reproduction
|
---|
[422] | 1017 | type:f 0 1 0.8
|
---|
[421] | 1018 | group:Foraminifera
|
---|
[380] | 1019 |
|
---|
[486] | 1020 | property:
|
---|
[422] | 1021 | id:energies0_haplo
|
---|
| 1022 | name:Energy of offspring from diploid forams
|
---|
| 1023 | type:f
|
---|
| 1024 | group:Foraminifera
|
---|
| 1025 |
|
---|
[486] | 1026 | property:
|
---|
[422] | 1027 | id:energies0_diplo
|
---|
| 1028 | name:Energy of offspring from diploid forams
|
---|
| 1029 | type:f
|
---|
| 1030 | group:Foraminifera
|
---|
| 1031 |
|
---|
[486] | 1032 | property:
|
---|
[475] | 1033 | id:e_death_level_haplo
|
---|
| 1034 | name:Minimal level of energy to sustain life of haploid
|
---|
[479] | 1035 | type:f 0 20 0.2
|
---|
[475] | 1036 | group:Foraminifera
|
---|
| 1037 |
|
---|
[486] | 1038 | property:
|
---|
[475] | 1039 | id:e_death_level_diplo
|
---|
| 1040 | name:Minimal level of energy to sustain life of diploid
|
---|
[479] | 1041 | type:f 0 20 0.2
|
---|
[475] | 1042 | group:Foraminifera
|
---|
| 1043 |
|
---|
[486] | 1044 | property:
|
---|
[422] | 1045 | id:energy_hib
|
---|
| 1046 | name:Energy used for hibernation during one step
|
---|
| 1047 | type:f 0 1 0.001
|
---|
| 1048 | group:Foraminifera
|
---|
| 1049 |
|
---|
[486] | 1050 | property:
|
---|
[422] | 1051 | id:energy_move
|
---|
| 1052 | name:Energy used for movement during one step
|
---|
| 1053 | type:f 0 20 0.001
|
---|
| 1054 | group:Foraminifera
|
---|
| 1055 |
|
---|
[486] | 1056 | property:
|
---|
[422] | 1057 | id:min_vol
|
---|
| 1058 | name:Minimal volume for reproduction
|
---|
| 1059 | type:f 100 900 100
|
---|
| 1060 | group:Foraminifera
|
---|
| 1061 |
|
---|
[486] | 1062 | property:
|
---|
[422] | 1063 | id:max_size
|
---|
| 1064 | name:Maximal size
|
---|
| 1065 | type:d 1 10 5
|
---|
| 1066 | group:Foraminifera
|
---|
| 1067 |
|
---|
[486] | 1068 | property:
|
---|
[422] | 1069 | id:foramPop
|
---|
| 1070 | name:Initial forams population size
|
---|
| 1071 | type:d 1 1000 100
|
---|
| 1072 | group:Foraminifera
|
---|
| 1073 |
|
---|
[486] | 1074 | property:
|
---|
[380] | 1075 | id:crossprob
|
---|
[401] | 1076 | name:Crossover probability
|
---|
| 1077 | type:f 0 1 0
|
---|
[421] | 1078 | group:Foraminifera
|
---|
[380] | 1079 |
|
---|
[486] | 1080 | property:
|
---|
[401] | 1081 | id:mutationprob
|
---|
| 1082 | name:Mutation probability
|
---|
| 1083 | type:f 0 1 0
|
---|
[421] | 1084 | group:Foraminifera
|
---|
[401] | 1085 |
|
---|
[486] | 1086 | property:
|
---|
[380] | 1087 | id:e_meta
|
---|
| 1088 | name:Idle metabolism
|
---|
| 1089 | type:f 0 1
|
---|
| 1090 | group:Energy
|
---|
| 1091 | help:Each stick consumes this amount of energy in one time step
|
---|
| 1092 |
|
---|
[486] | 1093 | property:
|
---|
[493] | 1094 | id:nutrient_pop
|
---|
[380] | 1095 | name:Feeding rate
|
---|
[474] | 1096 | type:f 0 1000000
|
---|
[380] | 1097 | group:Energy
|
---|
| 1098 | help:How fast energy is created in the world
|
---|
| 1099 |
|
---|
[486] | 1100 | property:
|
---|
[481] | 1101 | id:foodPeriodChange
|
---|
| 1102 | name:Set variable feed rate
|
---|
| 1103 | type:f 0
|
---|
| 1104 | group:Energy
|
---|
| 1105 |
|
---|
[486] | 1106 | property:
|
---|
[479] | 1107 | id:ingestion
|
---|
| 1108 | name:Ingestion rate
|
---|
| 1109 | type:f
|
---|
| 1110 | group:Energy
|
---|
| 1111 |
|
---|
[486] | 1112 | property:
|
---|
[422] | 1113 | id:energy_nut
|
---|
[428] | 1114 | name:Nutrient energy
|
---|
[493] | 1115 | type:f 0 10000000
|
---|
[380] | 1116 | group:Energy
|
---|
| 1117 |
|
---|
[486] | 1118 | property:
|
---|
[380] | 1119 | id:feedtrans
|
---|
[479] | 1120 | name:Energy transfer per second
|
---|
| 1121 | type:f 0 100000
|
---|
[380] | 1122 | group:Energy
|
---|
[422] | 1123 |
|
---|
[486] | 1124 | property:
|
---|
[479] | 1125 | id:foodperiod
|
---|
| 1126 | name:Time between food occurrences
|
---|
[481] | 1127 | type:f 0 1000000
|
---|
[422] | 1128 | group:Energy
|
---|
| 1129 |
|
---|
[486] | 1130 | property:
|
---|
[479] | 1131 | id:nutrientradius
|
---|
| 1132 | name:Nutrient size
|
---|
[493] | 1133 | type:f 0.001 0.9 0.1
|
---|
[421] | 1134 | group:Energy
|
---|
| 1135 |
|
---|
[486] | 1136 | property:
|
---|
[422] | 1137 | id:stress
|
---|
| 1138 | name:Environmental stress
|
---|
| 1139 | type:d 0 1 1
|
---|
| 1140 | group:World
|
---|
| 1141 |
|
---|
[486] | 1142 | property:
|
---|
[422] | 1143 | id:repro_trigger
|
---|
| 1144 | name:Reproduction trigger
|
---|
| 1145 | type:d 0 1 1
|
---|
| 1146 | group:World
|
---|
| 1147 |
|
---|
[486] | 1148 | property:
|
---|
[422] | 1149 | id:repro_time
|
---|
| 1150 | name:Time before reproduction
|
---|
[474] | 1151 | type:d 0 10000
|
---|
[422] | 1152 |
|
---|
[486] | 1153 | property:
|
---|
[422] | 1154 | id:creath
|
---|
| 1155 | name:Creation height
|
---|
| 1156 | type:f -1 50
|
---|
| 1157 | help:~
|
---|
| 1158 | Vertical position (above the surface) where new Forams are revived.
|
---|
| 1159 | Negative values are only used in the water area:
|
---|
| 1160 | 0 = at the surface
|
---|
| 1161 | -0.5 = half depth
|
---|
| 1162 | -1 = just above the bottom~
|
---|
| 1163 |
|
---|
[421] | 1164 | state:
|
---|
| 1165 | id:nutrient
|
---|
[428] | 1166 | name:Nutrient locations
|
---|
[421] | 1167 | help:vector of vectors [x,y,energy]
|
---|
| 1168 | type:x
|
---|
| 1169 | flags:32
|
---|
| 1170 |
|
---|
[486] | 1171 | property:
|
---|
[380] | 1172 | id:autorestart
|
---|
| 1173 | name:Restart after extinction
|
---|
| 1174 | help:Restart automatically this experiment after the last creature has died?
|
---|
| 1175 | type:d 0 1
|
---|
| 1176 |
|
---|
| 1177 | state:
|
---|
| 1178 | id:notes
|
---|
| 1179 | name:Notes
|
---|
| 1180 | type:s 1
|
---|
| 1181 | help:~
|
---|
| 1182 | You can write anything here
|
---|
| 1183 | (it will be saved to the experiment file)~
|
---|
| 1184 |
|
---|
| 1185 | state:
|
---|
| 1186 | id:totaltestedcr
|
---|
[421] | 1187 | name:Evaluated Forams
|
---|
| 1188 | help:Total number of the Forams evaluated in the experiment
|
---|
[380] | 1189 | type:d
|
---|
| 1190 | flags:16
|
---|
| 1191 |
|
---|
[486] | 1192 | property:
|
---|
[421] | 1193 | id:logging
|
---|
| 1194 | name:Log statistics to file
|
---|
| 1195 | type:d 0 1 0
|
---|