Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 325: Line 325:
   sim.molecules[reac.outputs[j]].quantity += entier;
   sim.molecules[reac.outputs[j]].quantity += entier;
 +
  var lastone= false;
 +
  if(frac > 0)
 +
  lastone= (Math.random() < frac);
 +
  if(lastone)
 +
  {
 +
  for(var j= 0 ; j < reac.inputs.length ; ++j)
 +
    sim.molecules[reac.inputs[j]].quantity --;
 +
  for(var j= 0 ; j < reac.outputs.length ; ++j)
 +
    sim.molecules[reac.outputs[j]].quantity ++;
 +
  }
  }
  }

Revision as of 00:10, 3 August 2013