Generation Ships OXP scripting
Posted: Wed Dec 29, 2010 3:44 pm
I haven't had time to test this, but it seems to me that the code for populating generation ships in interstellar space:
Will add a ship with probability 0.02 30 times; i.e., there is a 1-(1-0.02)^30 ~= 0.5 probability that at least one ship will be added. This seems way too high, so am I missing something?
Code: Select all
this.shipWillExitWitchspace = function()
{
if(!system.isInterstellarSpace) return
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-1", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-2", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-3", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-4", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-5", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-6", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-7", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-8", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-9", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-10", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-11", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-12", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-13", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-14", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-15", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-16", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-17", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-18", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-19", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-20", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-21", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-22", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-23", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-24", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-25", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-26", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-27", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-28", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-29", 1, "wpm", [0, 0, 0], 250000)
if(Math.random() < 0.02) system.legacy_addShipsWithinRadius("generationship-30", 1, "wpm", [0, 0, 0], 250000)
}