Changeset 847 for experiments
- Timestamp:
- 01/31/19 03:43:35 (6 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r638 r847 60 60 pop.othermask = 0; 61 61 //pop.selfmask = 0x20002; pop.othermask = 0x10002; 62 pop.perfperiod = 25; 62 pop.perfperiod = 25; 63 63 pop.bodysim = 0; 64 64 … … 86 86 World.wrldwat = 200; 87 87 World.wrldsiz = micronsToFrams(100000); 88 wrldsizSquareMeters = Math.pow(framsToMicrons(World.wrldsiz) *0.000001,2);88 wrldsizSquareMeters = Math.pow(framsToMicrons(World.wrldsiz) * 0.000001, 2); 89 89 World.wrldbnd = 1; 90 90 91 91 //ExpProperties.visualize = 1; //uncomment to visualize reticulopodia and indicate nutrients positions 92 92 93 //ExpProperties.logging = 1; //uncomment to enable logging simulation parameters to log files 93 //ExpProperties.logging = 1; //uncomment to enable logging simulation parameters to log files 94 94 ExpProperties.logPref = ""; 95 95 … … 99 99 ExpProperties.chamber_proculus_haplo = micronsToFrams(20); 100 100 ExpProperties.chamber_proculus_diplo = micronsToFrams(10); 101 colors = ["1.0,1.0,0.3", "1.0,0.7,0.0"]; //yellow and orange101 colors = ["1.0,1.0,0.3", "1.0,0.7,0.0"]; //yellow and orange 102 102 curColor = colors[0]; 103 103 curRadius = ExpProperties.zone1_range; … … 105 105 //nutrients 106 106 ExpProperties.nutrientradius = micronsToFrams(10); 107 ExpProperties.energy_nut = 200 * energyFromVolume(ExpProperties.nutrientradius, 1);107 ExpProperties.energy_nut = 200 * energyFromVolume(ExpProperties.nutrientradius, 1); 108 108 nutrientSqrCm = 10; 109 ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz) *0.0001,2)/nutrientSqrCm;109 ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz) * 0.0001, 2) / nutrientSqrCm; 110 110 111 111 ExpState.totaltestedcr = 0; … … 116 116 //addSpecies({"min_repro_energies" : [4,6]}); 117 117 //addSpecies({"min_repro_energies" : [4,8]}); 118 118 119 119 //Simulator.print(create_genotype(0.2, 30, "1.0,1.0,0.0", 0.6)); //sample call 120 120 //Simulator.print(create_genotype(0.1, 40, "1.0,0.5,0.0", 0.1)); //sample call … … 135 135 if (ExpProperties.max_chamber_num_haplo == max_chambers_def && ExpProperties.max_chamber_num_diplo == max_chambers_def) 136 136 { 137 max_chamber_volume = [[30403.5869594578, 52812.2546633948,79578.5148482541,113588.815134453,154620.677376218,205094.322220826,262572.712174265,326078.453295303,402342.518962956,498133.985678766,615066.864740109,759500.497626816,937064.025544282,1155915.25563075,1429139.14079748,1762487.92940157,2176286.62046069,2685795.63187845,3316190.12127043,4096436.04462706,5051343.25226193,6231980.1061213,7687880.79524734,9485307.02904958,11716968.9852569,14459866.4934433,17836388.9853663,22004935.7247348,27138607.2546045,33482425.1582986,41336775.1280297,50997910.7842793,62888631.7871037,77563060.9243464,95659468.591964]138 , [3430.07716920763,6159.93090353532,9322.94192815286,13462.9896597283,18399.8550832969,24558.9218126892,31468.8148639192,39189.4977865513,48404.4292075836,60185.8639086061,74490.6048472854,92117.8178412275,113852.779747083,140714.366929552,174450.937643841,215250.242147183,266323.295274072,328858.042352538,406552.379957238,503526.321155323,621060.781025019,767240.824049468,947210.683224091,1169506.19906112,1447211.61255879,1787155.29073739,2205627.64766244,2723413.2837305,3360233.53738709,4147771.02835393,5126445.06973928,6328060.3331703,7805693.278958,9631924.72156452,11884287.1596814]];137 max_chamber_volume = [[30403.5869594578, 52812.2546633948, 79578.5148482541, 113588.815134453, 154620.677376218, 205094.322220826, 262572.712174265, 326078.453295303, 402342.518962956, 498133.985678766, 615066.864740109, 759500.497626816, 937064.025544282, 1155915.25563075, 1429139.14079748, 1762487.92940157, 2176286.62046069, 2685795.63187845, 3316190.12127043, 4096436.04462706, 5051343.25226193, 6231980.1061213, 7687880.79524734, 9485307.02904958, 11716968.9852569, 14459866.4934433, 17836388.9853663, 22004935.7247348, 27138607.2546045, 33482425.1582986, 41336775.1280297, 50997910.7842793, 62888631.7871037, 77563060.9243464, 95659468.591964] 138 , [3430.07716920763, 6159.93090353532, 9322.94192815286, 13462.9896597283, 18399.8550832969, 24558.9218126892, 31468.8148639192, 39189.4977865513, 48404.4292075836, 60185.8639086061, 74490.6048472854, 92117.8178412275, 113852.779747083, 140714.366929552, 174450.937643841, 215250.242147183, 266323.295274072, 328858.042352538, 406552.379957238, 503526.321155323, 621060.781025019, 767240.824049468, 947210.683224091, 1169506.19906112, 1447211.61255879, 1787155.29073739, 2205627.64766244, 2723413.2837305, 3360233.53738709, 4147771.02835393, 5126445.06973928, 6328060.3331703, 7805693.278958, 9631924.72156452, 11884287.1596814]]; 139 139 } 140 140 … … 143 143 max_chamber_volume = [Vector.new(), Vector.new()]; 144 144 var density = 100; 145 for (var ploid = 0; ploid < 2; ploid++) 145 for (var ploid = 0; ploid < 2; ploid++) 146 146 { 147 147 var rad = getPloidRadius(ploid); 148 for (var cham_num = 0; cham_num < getProperty(ploid, "max_chamber_num"); cham_num++)148 for (var cham_num = 0; cham_num < getProperty(ploid, "max_chamber_num"); cham_num++) 149 149 { 150 max_chamber_volume[ploid].add(volumeFromGeno(ploid, rad, cham_num +1, density));151 } 150 max_chamber_volume[ploid].add(volumeFromGeno(ploid, rad, cham_num + 1, density)); 151 } 152 152 } 153 153 } … … 162 162 for (var i = 0; i < ExpProperties.foramPop; i++) 163 163 { 164 addInitialForam(spec, i); 164 addInitialForam(spec, i); 165 165 } 166 166 } … … 239 239 { 240 240 var geno = create_genotype(rad, chamber_num, colors[morphotype], 1); 241 var m =Model.newFromString(geno);242 var mg =ModelGeometry.forModel(m);243 mg.geom_density =density;241 var m = Model.newFromString(geno); 242 var mg = ModelGeometry.forModel(m); 243 mg.geom_density = density; 244 244 var volumeInFrams = mg.volume(); 245 245 246 return volumeInFrams/Math.pow(ExpProperties.scalingFactor,3); 247 } 248 249 function secToSimSteps(value_in_sec){ 250 return value_in_sec/ExpProperties.secPerStep; 246 return volumeInFrams / Math.pow(ExpProperties.scalingFactor, 3); 247 } 248 249 function secToSimSteps(value_in_sec) 250 { 251 return value_in_sec / ExpProperties.secPerStep; 251 252 } 252 253 253 254 function volumeInMicrons(radiusInFrams) 254 255 { 255 return 4.0 /3.0*Math.pi*Math.pow(framsToMicrons(radiusInFrams),3);256 return 4.0 / 3.0 * Math.pi * Math.pow(framsToMicrons(radiusInFrams), 3); 256 257 } 257 258 … … 260 261 if (isRadiusInFrams == 1) //radius in frams 261 262 { 262 return ExpProperties.picoCarbonPerMikro *volumeInMicrons(base);263 return ExpProperties.picoCarbonPerMikro * volumeInMicrons(base); 263 264 } 264 265 else //volume in microns … … 270 271 function getMovePerStep() 271 272 { 272 return micronsToFrams((ExpProperties.foramSpeedMmPerMin /60)*1000)*ExpProperties.secPerStep;273 return micronsToFrams((ExpProperties.foramSpeedMmPerMin / 60) * 1000) * ExpProperties.secPerStep; 273 274 } 274 275 275 276 function micronsToFrams(micrometers) 276 277 { 277 return micrometers *ExpProperties.scalingFactor;278 return micrometers * ExpProperties.scalingFactor; 278 279 } 279 280 280 281 function framsToMicrons(framsworldunits) 281 282 { 282 return framsworldunits /ExpProperties.scalingFactor;283 return framsworldunits / ExpProperties.scalingFactor; 283 284 } 284 285 … … 292 293 function getGene(cr, gen_id, gen_set) 293 294 { 294 if (cr.data->lifeparams->gen == 0) 295 if (cr.data->lifeparams->gen == 0) 295 296 return cr.data->genes[gen_id]; 296 else 297 else 297 298 return cr.data->genes[gen_set][gen_id]; 298 299 } … … 301 302 { 302 303 var radius = ExpProperties.chamber_proculus_haplo; 303 304 305 306 304 if (ploid == 1) 305 { 306 radius = ExpProperties.chamber_proculus_diplo; 307 } 307 308 return radius; 308 309 } … … 313 314 for (var i = 0; i < chamber_num; i++) 314 315 { 315 if (energy < energyFromVolume(max_chamber_volume[ploid][i], 0))316 { 317 chamber_num = i +1;316 if (energy < energyFromVolume(max_chamber_volume[ploid][i], 0)) 317 { 318 chamber_num = i + 1; 318 319 break; 319 } 320 } 321 320 } 321 } 322 322 323 return chamber_num; 323 324 } … … 326 327 { 327 328 var cr = Populations[pop_num].add(geno); 328 cr.rotate(0, 0,Math.rndUni(rotate_min, rotate_max));329 return cr; 329 cr.rotate(0, 0, Math.rndUni(rotate_min, rotate_max)); 330 return cr; 330 331 } 331 332 … … 337 338 var geno = create_genotype(radius, chambernum, colors[ploid], 1); 338 339 curColor = colors[ploid]; 339 var cr = createAndRotate(geno, 0, 2 *Math.pi, 0);340 var cr = createAndRotate(geno, 0, 2 * Math.pi, 0); 340 341 cr.name = "Initial creature" + species + "_" + iter; 341 342 placeRandomlyNotColliding(cr); … … 355 356 { 356 357 ploid = 1; 357 } 358 } 358 359 //add new foram with random energy bewtween starting energy and reproduction threshold 359 360 var repro_thr = species_genes[species]->min_repro_energies[ploid]; 360 var start_energy = Math.rndUni(energyFromVolume(getPloidRadius(ploid), 1),repro_thr-0.25*repro_thr);361 addForam(species, iter, start_energy, ploid);361 var start_energy = Math.rndUni(energyFromVolume(getPloidRadius(ploid), 1), repro_thr - 0.25 * repro_thr); 362 addForam(species, iter, start_energy, ploid); 362 363 } 363 364 … … 365 366 function addSpecies(new_genes) 366 367 { 367 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});368 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}); 368 369 for (var i = 0; i < new_genes.size; i++) 369 370 { 370 371 var key = new_genes.getKey(i); 371 species_genes[species_genes.size -1][key] = new_genes[key];372 } 372 species_genes[species_genes.size - 1][key] = new_genes[key]; 373 } 373 374 } 374 375 … … 378 379 { 379 380 //percent of current energy 380 cr.idleen = (ExpProperties.e_meta * cr.energy) *ExpProperties.secPerStep;381 cr.idleen = (ExpProperties.e_meta * cr.energy) * ExpProperties.secPerStep; 381 382 } 382 383 … … 388 389 function getZoneRange(cr, zone_num) 389 390 { 390 return ExpProperties.["zone" +zone_num+"_range"];391 return ExpProperties.["zone" + zone_num + "_range"]; 391 392 } 392 393 393 394 function addReticulopodia(cr, radius) 394 395 { 395 396 397 398 399 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="+radius+",sz="+radius+",ry=1.57079633,vr="+curColor+"\nj:0, 1, sh=1");400 401 402 ret.locationSetBboxLow(cr.bboxCenter.x-radius, cr.bboxCenter.y-radius, cr.bboxCenter.z-radius);396 if (reticulopodiaExists(cr)) 397 { 398 Populations[2].delete(cr.data->reticulopodiacreature); 399 } 400 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=" + radius + ",sz=" + radius + ",ry=1.57079633,vr=" + curColor + "\nj:0, 1, sh=1"); 401 cr.data->reticulopodiacreature = ret; 402 ret.getMechPart(0).orient.set(cr.getMechPart(0).orient); 403 ret.locationSetBboxLow(cr.bboxCenter.x - radius, cr.bboxCenter.y - radius, cr.bboxCenter.z - radius); 403 404 } 404 405 … … 421 422 if (!cr.boundingBoxCollisions(0)) 422 423 { 423 cr.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y, -cr.getPart(cr.numparts -1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)424 cr.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y, -cr.getPart(cr.numparts - 1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber) 424 425 return cr; 425 426 } … … 451 452 function foramGrow(cr, chamber_num, lastchambergrowth) 452 453 { 453 if ((chamber_num +1) <= max_chamber_volume[cr.data->lifeparams->gen].size)454 if ((chamber_num + 1) <= max_chamber_volume[cr.data->lifeparams->gen].size) 454 455 { 455 456 curColor = colors[cr.data->lifeparams->gen]; 456 457 var ploid = cr.data->lifeparams->gen; 457 var geno = create_genotype(getPloidRadius(ploid), chamber_num +1, colors[ploid], lastchambergrowth);458 var geno = create_genotype(getPloidRadius(ploid), chamber_num + 1, colors[ploid], lastchambergrowth); 458 459 var cr2 = createAndRotate(geno, 0, 0, 0); 459 460 … … 463 464 464 465 setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : "growth", "energy0" : cr.energy0}); 465 cr2.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y, cr.bboxLow.z);466 cr2.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y, cr.bboxLow.z); 466 467 setForamMeta(cr2); 467 468 … … 479 480 { 480 481 var total_time = secToSimSteps(ExpProperties.chamberGrowthSec); 481 var ret_unit = total_time /chamber_vis_denominator;482 var chamber_unit = total_time -ret_unit;482 var ret_unit = total_time / chamber_vis_denominator; 483 var chamber_unit = total_time - ret_unit; 483 484 484 485 if (chamber_time < ret_unit || chamber_time >= chamber_unit) 485 486 { 486 var new_rad = Math.min(Math.max((chamber_time %ret_unit)/ret_unit*getZoneRange(cr,1),0.01),getZoneRange(cr,1));487 var new_rad = Math.min(Math.max((chamber_time % ret_unit) / ret_unit * getZoneRange(cr, 1), 0.01), getZoneRange(cr, 1)); 487 488 488 489 if(chamber_time < ret_unit) 489 490 { 490 new_rad = getZoneRange(cr, 1)-new_rad;491 new_rad = getZoneRange(cr, 1) - new_rad; 491 492 } 492 493 493 494 curColor = colors[cr.data->lifeparams->gen]; 494 addReticulopodia(cr, new_rad);495 addReticulopodia(cr, new_rad); 495 496 496 497 if (chamber_time == 0)//checking for end of chamber growth process 497 498 { 498 cr.data->lifeparams->chamber_growth = -1; 499 cr.data->lifeparams->chamber_growth = -1; 499 500 } 500 501 } 501 502 else 502 503 { 503 var new_rad = 1 - Math.min(Math.max((chamber_time -ret_unit)/chamber_unit,0.01),1);504 var new_rad = 1 - Math.min(Math.max((chamber_time - ret_unit) / chamber_unit, 0.01), 1); 504 505 curRadius = cr.data->reticulopodiacreature.getPart(1).sy; 505 506 506 507 if (chamber_time == ret_unit) 507 508 { … … 509 510 } 510 511 511 var new_cr = foramGrow(cr, chamberNumFromEnergy(cr.data->lifeparams->max_energy_level, cr.data->lifeparams->gen) -1, new_rad);512 curRadius = getZoneRange(new_cr, 1);512 var new_cr = foramGrow(cr, chamberNumFromEnergy(cr.data->lifeparams->max_energy_level, cr.data->lifeparams->gen) - 1, new_rad); 513 curRadius = getZoneRange(new_cr, 1); 513 514 } 514 515 } … … 517 518 { 518 519 var p = XYZ.new(cr.bboxCenter.x, cr.bboxCenter.y, cr.bboxCenter.z); 519 var n = cr.signals.receiveSet("nutrient", getZoneRange(cr, 2));520 var n = cr.signals.receiveSet("nutrient", getZoneRange(cr, 2)); 520 521 521 522 //if signals are received find the source of the nearest … … 536 537 distvec.sub(p); 537 538 dist = distvec.length; 538 if (dist < getZoneRange(cr, 1))539 if (dist < getZoneRange(cr, 1)) 539 540 { 540 541 if (n[i].value != null) … … 562 563 return 1; 563 564 } 564 565 565 566 else 566 567 { … … 574 575 { 575 576 //percent of maximal energy 576 cr.energy -= (ExpProperties.energy_move * cr.data->lifeparams->max_energy_level) *ExpProperties.secPerStep;577 cr.energy -= (ExpProperties.energy_move * cr.data->lifeparams->max_energy_level) * ExpProperties.secPerStep; 577 578 } 578 579 } … … 580 581 function fence(center, zone) 581 582 { 582 return Math.min(Math.max(0 +zone,center),World.wrldsiz-zone); //add and subtract zone from the world size to prevent reticulopodia from crossing the fence583 return Math.min(Math.max(0 + zone, center), World.wrldsiz - zone); //add and subtract zone from the world size to prevent reticulopodia from crossing the fence 583 584 } 584 585 … … 588 589 { 589 590 var moved = stepToNearest(cr); //TODO weighted sum of distance and energy 590 if (moved ==1)591 { 591 if (moved == 1) 592 { 592 593 moveReticulopodia(cr); 593 594 return; … … 595 596 } 596 597 597 //Prevents forams from crossing the world border. In the case of touching the border with the reticulopodia direction of the movement should be changed. 598 //Prevents forams from crossing the world border. In the case of touching the border with the reticulopodia direction of the movement should be changed. 598 599 var change_direction = 0; 599 600 var new_x = fence(cr.bboxCenter.x, getZoneRange(cr, 1)); … … 603 604 { 604 605 change_direction = 1; 605 cr.locationSetBboxLow(new_x -cr.bboxSize.x/2, new_y-cr.bboxSize.y/2, -cr.getPart(cr.numparts-1).sx);//place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)606 cr.locationSetBboxLow(new_x - cr.bboxSize.x / 2, new_y - cr.bboxSize.y / 2, -cr.getPart(cr.numparts - 1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber) 606 607 } 607 608 608 609 //no nutrients in zone 2 609 if (getGene(cr, "hibernation", 0) == 1)610 if (getGene(cr, "hibernation", 0) == 1) 610 611 { 611 612 reverseHib(cr); 612 cr.drive = XYZ.new(0, 0,0);613 cr.drive = XYZ.new(0, 0, 0); 613 614 } 614 615 //random move … … 631 632 if (visualization(cr)) 632 633 { 633 cr.data->reticulopodiacreature.locationSetBboxLow(cr.bboxCenter.x -getZoneRange(cr,1), cr.bboxCenter.y-getZoneRange(cr,1), cr.bboxCenter.z-getZoneRange(cr,1));634 cr.data->reticulopodiacreature.locationSetBboxLow(cr.bboxCenter.x - getZoneRange(cr, 1), cr.bboxCenter.y - getZoneRange(cr, 1), cr.bboxCenter.z - getZoneRange(cr, 1)); 634 635 cr.data->reticulopodiacreature.drive = cr.drive; 635 636 } … … 638 639 function randomDir() 639 640 { 640 var dir = (Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), 0); 641 var dir = (Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), 0); 641 642 dir.normalize(); 642 dir.scale(-1 *movePerStep);643 dir.scale(-1 * movePerStep); 643 644 return dir; 644 645 } … … 646 647 function energyTransfer(cr1, cr2) 647 648 { 648 cr1.drive = XYZ.new(0, 0,0);649 var e = ExpProperties.feedtrans *cr1.energy*ExpProperties.secPerStep; //TODO efficiency dependent on age649 cr1.drive = XYZ.new(0, 0, 0); 650 var e = ExpProperties.feedtrans * cr1.energy * ExpProperties.secPerStep; //TODO efficiency dependent on age 650 651 //Simulator.print("transferring "+e +"("+e*ExpProperties.ingestion+")"+" to "+cr1.name +" ("+ cr1.energy+") " +" from "+cr2.uid+" ("+cr2.energy+") "+ e/ExpProperties.secPerStep+ " per sec"); 651 652 var transferred = cr2.transferEnergyTo(cr1, e); 652 cr1.energy -= transferred *(1-ExpProperties.ingestion);653 cr1.energy -= transferred * (1 - ExpProperties.ingestion); 653 654 if (cr1.data->lifeparams->hibernated == 1) 654 655 { … … 662 663 { 663 664 setForamMeta(cr); //unhibernate 664 } 665 } 665 666 else 666 667 { 667 cr.idleen = (ExpProperties.energy_hib * cr.energy) *ExpProperties.secPerStep; //hibernate668 cr.idleen = (ExpProperties.energy_hib * cr.energy) * ExpProperties.secPerStep; //hibernate 668 669 } 669 670 cr.data->lifeparams->hibernated = 1 - cr.data->lifeparams->hibernated; … … 675 676 if (cr.data->lifeparams->division_time > 0) 676 677 { 677 cr.data->lifeparams->division_time = Math.max(cr.data->lifeparams->division_time -1,0);678 cr.data->lifeparams->division_time = Math.max(cr.data->lifeparams->division_time - 1, 0); 678 679 } 679 680 //checking for end of gametogenesis … … 685 686 else if (cr.data->lifeparams->chamber_growth > 0) 686 687 { 687 var chamber_time = Math.max(cr.data->lifeparams->chamber_growth -1,0);688 var chamber_time = Math.max(cr.data->lifeparams->chamber_growth - 1, 0); 688 689 cr.data->lifeparams->chamber_growth = chamber_time; 689 690 cr.energy -= ExpProperties.chamberCostPerSec * cr.energy * ExpProperties.secPerStep; … … 695 696 } 696 697 //checking for end of the chamber growth process 697 else if (cr.data->lifeparams->chamber_growth == 0 && visualization(cr) ==0)698 { 699 foramGrow(cr, lastChamberNum(cr), 1); 698 else if (cr.data->lifeparams->chamber_growth == 0 && visualization(cr) == 0) 699 { 700 foramGrow(cr, lastChamberNum(cr), 1); 700 701 cr.data->lifeparams->chamber_growth = -1; 701 702 //Simulator.print("chamber "+ (lastChamberNum(cr) + 1) +" complete"); … … 713 714 if (ExpProperties.logging == 1) 714 715 { 715 log(createLogVector(cr, cr.data->lifeparams->max_energy_level), ExpProperties.logPref+"fossil_log.txt");716 log(createLogVector(cr, cr.lifespan), ExpProperties.logPref+"lifespan_log.txt");717 } 716 log(createLogVector(cr, cr.data->lifeparams->max_energy_level), ExpProperties.logPref + "fossil_log.txt"); 717 log(createLogVector(cr, cr.lifespan), ExpProperties.logPref + "lifespan_log.txt"); 718 } 718 719 Populations[0].kill(cr); 719 720 return; … … 736 737 if (lastChamberNum(cr) < max_chamber_volume[cr.data->lifeparams->gen].size) 737 738 { 738 if ((cr.data->lifeparams->max_energy_level >= energyFromVolume(max_chamber_volume[cr.data->lifeparams->gen][lastChamberNum(cr) -1],0)))739 if ((cr.data->lifeparams->max_energy_level >= energyFromVolume(max_chamber_volume[cr.data->lifeparams->gen][lastChamberNum(cr) - 1], 0))) 739 740 { 740 741 cr.data->lifeparams->chamber_growth = int(secToSimSteps(ExpProperties.chamberGrowthSec)); 741 } 742 } 743 } 742 } 743 } 744 } 744 745 } 745 746 746 747 function deathConditions(cr) 747 748 { 748 if ((cr.energy <= getProperty(cr.data->lifeparams->gen, "e_death_level")*cr.data->lifeparams->max_energy_level) || (Math.rnd01 < ExpProperties.hunted_prob))749 if ((cr.energy <= getProperty(cr.data->lifeparams->gen, "e_death_level")*cr.data->lifeparams->max_energy_level) || (Math.rnd01 < ExpProperties.hunted_prob)) 749 750 { 750 751 return 1; … … 774 775 function createNutrientGenotype(nutrientradius) 775 776 { 776 return "//0\nm:Vstyle=nutrient\np:sh=3,sx=" +nutrientradius+",sy="+nutrientradius+",sz="+nutrientradius+",ry=1.57,vr=0.0,1.0,0.0";777 return "//0\nm:Vstyle=nutrient\np:sh=3,sx=" + nutrientradius + ",sy=" + nutrientradius + ",sz=" + nutrientradius + ",ry=1.57,vr=0.0,1.0,0.0"; 777 778 } 778 779 … … 797 798 if (ExpProperties.visualize == 1) 798 799 { 799 var nutsize = ExpProperties.nutrientradius *10;800 var nut = Populations[2].add("//0\nm:Vstyle=nutrient_visual\np:sh=2,sx=" +nutsize+",sy="+nutsize+",sz="+nutsize+",ry=1.5,vr=0.0,1.0,0.0");800 var nutsize = ExpProperties.nutrientradius * 10; 801 var nut = Populations[2].add("//0\nm:Vstyle=nutrient_visual\np:sh=2,sx=" + nutsize + ",sy=" + nutsize + ",sz=" + nutsize + ",ry=1.5,vr=0.0,1.0,0.0"); 801 802 cr.data->reticulopodiacreature = nut; 802 nut.locationSetBboxLow( cr.bboxLow.x +cr.bboxSize.x/2-nut.bboxSize.x/2, cr.bboxLow.y+cr.bboxSize.y/2-nut.bboxSize.y/2, -nutsize);803 nut.locationSetBboxLow( cr.bboxLow.x + cr.bboxSize.x / 2 - nut.bboxSize.x / 2, cr.bboxLow.y + cr.bboxSize.y / 2 - nut.bboxSize.y / 2, -nutsize); 803 804 } 804 805 } … … 815 816 { 816 817 counter += increase; 817 var unitcount = int(counter /unitsize);818 counter -= unitcount *unitsize;818 var unitcount = int(counter / unitsize); 819 counter -= unitcount * unitsize; 819 820 return {"counter" : counter, "number" : unitcount}; 820 821 } … … 824 825 if (ExpProperties.foodfluxChange > 0) 825 826 { 826 827 if (phase=="low" && changePeriod >= secToSimSteps(23328000)) //9 months828 829 ExpProperties.foodflux = ExpProperties.foodflux/ExpProperties.foodfluxChange;830 831 832 833 834 835 836 ExpProperties.foodflux = ExpProperties.foodflux*ExpProperties.foodfluxChange;837 838 839 840 } 841 842 var nutrientNum = getNumberCounter(nutrient_num_counter, ExpProperties.foodflux *wrldsizSquareMeters*ExpProperties.secPerStep,ExpProperties.energy_nut*0.000000000001);827 changePeriod += 1; 828 if (phase == "low" && changePeriod >= secToSimSteps(23328000)) //9 months 829 { 830 ExpProperties.foodflux = ExpProperties.foodflux / ExpProperties.foodfluxChange; 831 phase = "high"; 832 changePeriod = 0; 833 } 834 835 else if (phase == "high" && changePeriod >= secToSimSteps(7776000)) //3 months 836 { 837 ExpProperties.foodflux = ExpProperties.foodflux * ExpProperties.foodfluxChange; 838 phase = "low"; 839 changePeriod = 0; 840 } 841 } 842 843 var nutrientNum = getNumberCounter(nutrient_num_counter, ExpProperties.foodflux * wrldsizSquareMeters * ExpProperties.secPerStep, ExpProperties.energy_nut * 0.000000000001); 843 844 844 845 nutrient_num_counter = nutrientNum["counter"]; 845 846 846 847 for (var i = 0; i < nutrientNum["number"]; i++) 847 { 848 { 848 849 addNutrient(); 849 850 } … … 851 852 if (ExpProperties.logging == 1 && nutrientNum["number"] > 0) 852 853 { 853 log([nutrientNum["number"]], ExpProperties.logPref+"nutrients_log.txt");854 log([nutrientNum["number"]], ExpProperties.logPref + "nutrients_log.txt"); 854 855 } 855 856 … … 878 879 reproduce_parents(s); 879 880 } 880 881 881 882 } 882 883 … … 903 904 904 905 function createStatistics() 905 { 906 { 906 907 var number = []; 907 908 var e_inc = []; … … 910 911 for (var s = 0; s < species_genes.size; s++) 911 912 { 912 number.add([0, 0]);// [haplo][diplo]913 e_inc.add([0, 0]);913 number.add([0, 0]); // [haplo][diplo] 914 e_inc.add([0, 0]); 914 915 } 915 916 … … 920 921 var species = cr.data->lifeparams->species; 921 922 922 number[species][gen] = number[species][gen] + 1; 923 number[species][gen] = number[species][gen] + 1; 923 924 e_inc[species][gen] = e_inc[species][gen] + cr.energy; 924 925 } … … 941 942 } 942 943 } 943 944 944 945 log_numbers.add(Populations[1].size); 945 946 log_energies.add(e_nut); 946 947 947 log(log_numbers, ExpProperties.logPref +"forams_log.txt");948 log(log_energies, ExpProperties.logPref+"energies_log.txt");948 log(log_numbers, ExpProperties.logPref + "forams_log.txt"); 949 log(log_energies, ExpProperties.logPref + "energies_log.txt"); 949 950 } 950 951 951 952 function log(tolog, fname) 952 953 { 953 var f = File.appendDirect(fname, "forams data"); 954 var f = File.appendDirect(fname, "forams data"); 954 955 f.writeString("" + Simulator.stepNumber); 955 956 for (var i = 0; i < tolog.size; i++) … … 972 973 if (cr.data->lifeparams->species == i) 973 974 { 974 vec[i *2+cr.data->lifeparams->gen] = value;975 vec[i * 2 + cr.data->lifeparams->gen] = value; 975 976 } 976 977 } -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r595 r847 2 2 function create_genotype(proculus_size, number_of_chambers, rgbstring, lastchambergrowth) //lastchambergrowth is 0..1 3 3 { 4 const shift =0.7;5 const angle_delta =0.8;6 const angle_delta_delta =-0.01;7 const growing =1.07; //7% growth8 9 var str ="//0\nm:Vstyle=foram\n";10 var size =proculus_size;11 for(var i =0;i<number_of_chambers;i++)12 { 13 var effectivesize =size; //'effectivesize' is introduced only to consider the last chamber14 if (i ==number_of_chambers-1) //last chamber15 { 16 effectivesize *=lastchambergrowth;17 size =size*(1.35-0.35*lastchambergrowth); //last iteration: 'size' is only used for shifting (dx). The last chamber emerges at the surface of the previous one18 if (lastchambergrowth <1)19 rgbstring ="0.9,0.9,0.9,i=\"growing=%g\"" % lastchambergrowth; //when the last chamber is growing, make it bright gray and add extra information in its "i" field4 const shift = 0.7; 5 const angle_delta = 0.8; 6 const angle_delta_delta = -0.01; 7 const growing = 1.07; //7% growth 8 9 var str = "//0\nm:Vstyle=foram\n"; 10 var size = proculus_size; 11 for(var i = 0; i < number_of_chambers; i++) 12 { 13 var effectivesize = size; //'effectivesize' is introduced only to consider the last chamber 14 if (i == number_of_chambers - 1) //last chamber 15 { 16 effectivesize *= lastchambergrowth; 17 size = size * (1.35 - 0.35 * lastchambergrowth); //last iteration: 'size' is only used for shifting (dx). The last chamber emerges at the surface of the previous one 18 if (lastchambergrowth < 1) 19 rgbstring = "0.9,0.9,0.9,i=\"growing=%g\"" % lastchambergrowth; //when the last chamber is growing, make it bright gray and add extra information in its "i" field 20 20 } 21 21 str += "p:sh=1,sx=%g,sy=%g,sz=%g,rz=3.14159265358979,vr=%s\n" % effectivesize % effectivesize % effectivesize % rgbstring; 22 if (i >0)23 str +="j:%d,%d,sh=1,dx=%g,rz=%g\n" % (i-1) % i % (size*shift) % (angle_delta+i*angle_delta_delta);24 size *=growing;22 if (i > 0) 23 str += "j:%d,%d,sh=1,dx=%g,rz=%g\n" % (i - 1) % i % (size * shift) % (angle_delta + i * angle_delta_delta); 24 size *= growing; 25 25 } 26 26 return str; … … 38 38 { 39 39 foram_uid += 1; 40 var new_id = "c" +string(foram_uid);40 var new_id = "c" + string(foram_uid); 41 41 mode->cr.data->genes = String.deserialize(String.serialize(mode->genes)); 42 mode->cr.data->lifeparams = {"max_energy_level" : mode->energy0, "gen" : mode->gen, "hibernated" : 0, "species" : mode->species, "reproduce" : 0, "dir" : randomDir(), "dir_counter" : Math.random(int(secToSimSteps(ExpProperties.dir_change_sec))), "chamber_growth" : -1, "division_time" : -1, "uid" : new_id}; 42 mode->cr.data->lifeparams = {"max_energy_level" : mode->energy0, "gen" : mode->gen, "hibernated" : 0, "species" : mode->species, "reproduce" : 0, "dir" : randomDir(), "dir_counter" : Math.random(int(secToSimSteps(ExpProperties.dir_change_sec))), "chamber_growth" : -1, "division_time" : -1, "uid" : new_id}; 43 43 44 44 var oper = "cloning"; 45 45 var inherit = [1.0]; 46 46 if (mode->parentsuids.size > 1) 47 { 47 { 48 48 oper = "cross-over"; 49 49 inherit = [0.5, 0.5]; 50 50 } 51 52 var dict ={"Time":Simulator.stepNumber,"FromIDs":mode->parentsuids,"ID":new_id, "Inherited":inherit, "Operation": oper, "Kind" : mode->gen};53 Simulator.print("[OFFSPRING] " + String.serialize(dict)); 51 52 var dict = {"Time": Simulator.stepNumber, "FromIDs": mode->parentsuids, "ID": new_id, "Inherited": inherit, "Operation": oper, "Kind" : mode->gen}; 53 Simulator.print("[OFFSPRING] " + String.serialize(dict)); 54 54 } 55 55 } … … 57 57 function getEnergy0(radius) 58 58 { 59 return energyFromVolume(micronsToFrams(radius), 1);59 return energyFromVolume(micronsToFrams(radius), 1); 60 60 } 61 61 … … 64 64 var number = 1; 65 65 var result = parent_energy; 66 while ((result -ExpProperties.divisionCost) >= energy0)67 { 68 result = (result -ExpProperties.divisionCost)/2;66 while ((result - ExpProperties.divisionCost) >= energy0) 67 { 68 result = (result - ExpProperties.divisionCost) / 2; 69 69 number *= 2; 70 70 } … … 74 74 75 75 function reproduce_haploid(parent, parent2, clone) 76 { 76 { 77 77 var number, energy0, new_genes, gen; 78 78 if (clone == 1) 79 79 { 80 var offspring = gametsDivision(parent.energy, getEnergy0(getGene(parent,"energies0",0)[0]));80 var offspring = gametsDivision(parent.energy, getEnergy0(getGene(parent, "energies0", 0)[0])); 81 81 energy0 = offspring->energy; 82 82 number = offspring->number; … … 87 87 else 88 88 { 89 var offspring1 = gametsDivision(parent.energy, getEnergy0(getGene(parent,"energies0", 0)[1]));90 var offspring2 = gametsDivision(parent2.energy, getEnergy0(getGene(parent2,"energies0", 0)[1]));91 energy0 = (offspring1->energy +offspring2->energy);92 number = ExpProperties.gametSuccessRate *(offspring1->number+offspring2->number)/2;89 var offspring1 = gametsDivision(parent.energy, getEnergy0(getGene(parent, "energies0", 0)[1])); 90 var offspring2 = gametsDivision(parent2.energy, getEnergy0(getGene(parent2, "energies0", 0)[1])); 91 energy0 = (offspring1->energy + offspring2->energy); 92 number = ExpProperties.gametSuccessRate * (offspring1->number + offspring2->number) / 2; 93 93 new_genes = [parent.data->genes, parent2.data->genes]; 94 94 gen = 1 - parent.data->lifeparams->gen; … … 96 96 if (ExpProperties.logging == 1) 97 97 { 98 log(createLogVector(parent, parent.energy),ExpProperties.logPref+"repro_energies_log.txt");99 log(createLogVector(parent2, parent2.energy),ExpProperties.logPref+"repro_energies_log.txt");100 log(createLogVector(parent, number),ExpProperties.logPref+"repro_num_log.txt");101 log(createLogVector(parent, parent.lifespan),ExpProperties.logPref+"lifespan_log.txt");102 log(createLogVector(parent2, parent2.lifespan),ExpProperties.logPref+"lifespan_log.txt");103 } 98 log(createLogVector(parent, parent.energy), ExpProperties.logPref + "repro_energies_log.txt"); 99 log(createLogVector(parent2, parent2.energy), ExpProperties.logPref + "repro_energies_log.txt"); 100 log(createLogVector(parent, number), ExpProperties.logPref + "repro_num_log.txt"); 101 log(createLogVector(parent, parent.lifespan), ExpProperties.logPref + "lifespan_log.txt"); 102 log(createLogVector(parent2, parent2.lifespan), ExpProperties.logPref + "lifespan_log.txt"); 103 } 104 104 } 105 105 … … 114 114 function reproduce_diploid(parent) 115 115 { 116 var offspring = gametsDivision(parent.energy, getEnergy0(getGene(parent,"energies0", 0)[0]));117 var energy0 = offspring->energy; 116 var offspring = gametsDivision(parent.energy, getEnergy0(getGene(parent, "energies0", 0)[0])); 117 var energy0 = offspring->energy; 118 118 var number = offspring->number; 119 119 120 121 122 log(createLogVector(parent, parent.energy),ExpProperties.logPref+"repro_energies_log.txt");123 log(createLogVector(parent, number),ExpProperties.logPref+"repro_num_log.txt");124 log(createLogVector(parent, parent.lifespan),ExpProperties.logPref+"lifespan_log.txt");125 }120 if (ExpProperties.logging == 1) 121 { 122 log(createLogVector(parent, parent.energy), ExpProperties.logPref + "repro_energies_log.txt"); 123 log(createLogVector(parent, number), ExpProperties.logPref + "repro_num_log.txt"); 124 log(createLogVector(parent, parent.lifespan), ExpProperties.logPref + "lifespan_log.txt"); 125 } 126 126 127 127 //Simulator.print("diploid number of offspring: " + number+ " energ0: " + energy0); … … 139 139 for (var k = 0; k < 2; k++) 140 140 { 141 createOffspring(create_genotype(ExpProperties.chamber_proculus_haplo, 1, colors[0], 1), energy0, parent.data->genes[0], parent.data->lifeparams, [parent.data->lifeparams->uid]); 141 createOffspring(create_genotype(ExpProperties.chamber_proculus_haplo, 1, colors[0], 1), energy0, parent.data->genes[0], parent.data->lifeparams, [parent.data->lifeparams->uid]); 142 142 } 143 143 … … 148 148 crossed = 0; 149 149 } 150 150 151 151 } 152 152 } … … 154 154 function reproduce_parents(species) 155 155 { 156 var parent1 = null; 157 var parent2 = null; 158 var pop = Populations[0]; 159 for (var i = pop.size-1; i >= 0; i--) 160 { 161 if (pop[i].data->lifeparams->reproduce == 1 && pop[i].data->lifeparams->species == species) 162 { 163 if ((pop[i].data->lifeparams->gen==1) || ((pop[i].data->lifeparams->gen==0) && ExpProperties.stress == 0)) 156 var parent1 = null; 157 var parent2 = null; 158 var pop = Populations[0]; 159 for (var i = pop.size - 1; i >= 0; i--) 160 { 161 if (pop[i].data->lifeparams->reproduce == 1 && pop[i].data->lifeparams->species == species) 162 { 163 if ((pop[i].data->lifeparams->gen == 1) || ((pop[i].data->lifeparams->gen == 0) && ExpProperties.stress == 0)) 164 { 165 continue; 166 } 167 else if (parent1 == null) 168 { 169 parent1 = pop[i]; 170 } 171 else if (parent2 == null) 172 { 173 parent2 = pop[i]; 174 } 175 if (parent1 != null && parent2 != null) 176 { 177 //when parents are ready for reproduction start gametogenesis 178 if (parent1.data->lifeparams->division_time == -1 && parent2.data->lifeparams->division_time == -1) 164 179 { 165 continue; 180 var time = int(secToSimSteps(ExpProperties.gametoPeriodSec)); 181 parent1.data->lifeparams->division_time = time; 182 parent2.data->lifeparams->division_time = time; 183 parent1.idleen = 0; 184 parent2.idleen = 0; 185 //Simulator.print("parents "+parent1.uid + " " + parent2.uid + " ready to repro: "+Simulator.stepNumber); 166 186 } 167 else if (parent1 == null) 187 //when gametogenesis is finished fuse gamets 188 else if (parent1.data->lifeparams->division_time == 0 && parent2.data->lifeparams->division_time == 0) 168 189 { 169 parent1 = pop[i]; 190 reproduce_haploid(parent1, parent2, 0); 191 //print_repro_info(parent1); 192 //print_repro_info(parent2); 193 pop.kill(parent1); 194 pop.kill(parent2); 195 parent1 = null; 196 parent2 = null; 170 197 } 171 else if (parent2 == null) 172 { 173 parent2 = pop[i]; 174 } 175 if (parent1 != null && parent2 != null) 176 { 177 //when parents are ready for reproduction start gametogenesis 178 if (parent1.data->lifeparams->division_time == -1 && parent2.data->lifeparams->division_time == -1) 179 { 180 var time = int(secToSimSteps(ExpProperties.gametoPeriodSec)); 181 parent1.data->lifeparams->division_time = time; 182 parent2.data->lifeparams->division_time = time; 183 parent1.idleen = 0; 184 parent2.idleen = 0; 185 //Simulator.print("parents "+parent1.uid + " " + parent2.uid + " ready to repro: "+Simulator.stepNumber); 186 } 187 //when gametogenesis is finished fuse gamets 188 else if (parent1.data->lifeparams->division_time == 0 && parent2.data->lifeparams->division_time == 0) 189 { 190 reproduce_haploid(parent1, parent2, 0); 191 //print_repro_info(parent1); 192 //print_repro_info(parent2); 193 pop.kill(parent1); 194 pop.kill(parent2); 195 parent1 = null; 196 parent2 = null; 197 } 198 } 199 } 200 } 198 } 199 } 200 } 201 201 } 202 202 … … 219 219 if (cr.signals.size == 0) 220 220 { 221 cr.signals.add("repro" +cr.data->lifeparams->species);221 cr.signals.add("repro" + cr.data->lifeparams->species); 222 222 cr.signals[0].power = 1; 223 223 } … … 237 237 function foramReproduce(cr) 238 238 { 239 var properEnergy = cr.energy >= getGene(cr, "min_repro_energies", 0)[cr.data->lifeparams->gen];240 var reproduced = 0; 239 var properEnergy = cr.energy >= getGene(cr, "min_repro_energies", 0)[cr.data->lifeparams->gen]; 240 var reproduced = 0; 241 241 242 242 //if creature has proper energy … … 248 248 reproduced = readyToRepro(cr); 249 249 } 250 else if (cr.signals.receive("repro" +cr.data->lifeparams->species) > 0)250 else if (cr.signals.receive("repro" + cr.data->lifeparams->species) > 0) 251 251 { 252 252 reproduced = readyToRepro(cr); 253 253 } 254 254 if (reproduced == 1) 255 255 return 1; 256 256 } 257 257 … … 259 259 { 260 260 cr.signals.clear(); 261 cr.data->lifeparams->reproduce = 0; 261 cr.data->lifeparams->reproduce = 0; 262 262 } 263 263 … … 274 274 function createOffspring(geno, energy, parent_genes, parent_lifeparams, parentsuids) 275 275 { 276 curColor = colors[1 -parent_lifeparams->gen];277 var cr = createAndRotate(geno, 0, 2 *Math.pi, 0);276 curColor = colors[1 - parent_lifeparams->gen]; 277 var cr = createAndRotate(geno, 0, 2 * Math.pi, 0); 278 278 cr.energy0 = energy; 279 279 cr.energy = cr.energy0; -
experiments/frams/foraminifera/data/scripts/foraminifera.show
r590 r847 19 19 { 20 20 var nutrient_multiple = 200; 21 Params = { "foodflux" : [0.0000000037815, 0.0000000075631,0.000000015126], "feedtrans" : [0.0005,0.001,0.002],"energy_nut" :[nutrient_multiple*144.54,nutrient_multiple*544.54,nutrient_multiple*944.54], "stress" : [0,1], "visualize" : [0,1]};22 ShowProperties.visualize =1;23 ExpProperties.secPerStep =50;21 Params = { "foodflux" : [0.0000000037815, 0.0000000075631, 0.000000015126], "feedtrans" : [0.0005, 0.001, 0.002], "energy_nut" : [nutrient_multiple * 144.54, nutrient_multiple * 544.54, nutrient_multiple * 944.54], "stress" : [0, 1], "visualize" : [0, 1]}; 22 ShowProperties.visualize = 1; 23 ExpProperties.secPerStep = 50; 24 24 Simulator.init(); 25 last_simspeed =0;25 last_simspeed = 0; 26 26 GLDisplay.desiredsimspeed = 50; 27 27 GLDisplay.minfps = 10; 28 28 TrackingCam.cam_h = 15; //more side view 29 29 30 30 //useful for screenshots: 31 31 //GLDisplay.world_visibility=2+4; //show only environment and creatures (no background) … … 36 36 { 37 37 //just a draft, this function and all constants in expdef need serious review 38 var localDriveMicronsPerStep =framsToMicrons(getMovePerStep());39 var foramSpeedMmPerSec =ExpProperties.foramSpeedMmPerMin/60;40 var localDriveMmPerStep =localDriveMicronsPerStep/1000;41 var localDriveMmPerSec =localDriveMmPerStep*Simulator.simspeed;42 return localDriveMmPerSec /foramSpeedMmPerSec;38 var localDriveMicronsPerStep = framsToMicrons(getMovePerStep()); 39 var foramSpeedMmPerSec = ExpProperties.foramSpeedMmPerMin / 60; 40 var localDriveMmPerStep = localDriveMicronsPerStep / 1000; 41 var localDriveMmPerSec = localDriveMmPerStep * Simulator.simspeed; 42 return localDriveMmPerSec / foramSpeedMmPerSec; 43 43 } 44 44 45 45 function updateBanner() 46 46 { 47 GLDisplay.banner ="World size is %g mm." % (framsToMicrons(World.wrldsiz)/1000);48 GLDisplay.banner +="\nShowing real-time x %g." % timeScale();47 GLDisplay.banner = "World size is %g mm." % (framsToMicrons(World.wrldsiz) / 1000); 48 GLDisplay.banner += "\nShowing real-time x %g." % timeScale(); 49 49 } 50 50 51 51 function onShowStep() 52 52 { 53 if (Simulator.simspeed <last_simspeed*0.9 || Simulator.simspeed>last_simspeed*1.1) //significant change53 if (Simulator.simspeed < last_simspeed * 0.9 || Simulator.simspeed > last_simspeed * 1.1) //significant change 54 54 { 55 55 updateBanner(); 56 last_simspeed =Simulator.simspeed;56 last_simspeed = Simulator.simspeed; 57 57 } 58 58 }
Note: See TracChangeset
for help on using the changeset viewer.