Ejemplo n.º 1
0
def main():

    decayConstant = input('What is the value of the decay constant: ')
    size = input('What size should the list of nuclei be: ')
    timeInterval = input(
        'At what time interval should the simulation be run (mins): ')

    print('Beginning simulation...')

    sample = Sample(size, decayConstant)

    elapsedTime = 0.0

    while sample.getDecayedNuclei() < sample.getUndecayedNuclei():

        sample.stepForward(timeInterval)
        elapsedTime = elapsedTime + timeInterval

    sample.show()
    print('Simulation complete. There remain ' +
          str(sample.getDecayedNuclei()) + ' decayed nuclei and ' +
          str(sample.getUndecayedNuclei()) + ' undecayed nuclei.')
    print('The total elapsed time is ' + str(elapsedTime) + ' minutes.')