Konstantinos-infogeek
4/28/2013 - 11:02 PM

Simulates the creation of a moon for the online game ogame!

Simulates the creation of a moon for the online game ogame!

//Javascript Function

function moonShot(debris){

    var random = Math.ceil(Math.random()*100);
    debris = Math.round((debris.crystal + debris.metal)/100000);

    console.log("percent: "+debris+"\nrandom: "+random);
  
    if(debris>=20){ debris = 20; }

    if(random<=debris) {
        return "Moon has created!";
    }
    else{ 
        return "not created!";
    }
}