mauriceling/dose

Refactor revive_simulation() and simulate() to call simulation_core()

Closed this issue · 1 comments

  1. simulate() and revive_simulation() in dose.py contains the exact same block of code, with the exception that:
    • simulate() calls on prepare_simulation() whereas revive_simulation() calls prepare_revival()
    • simulate() deploys the organism whereas revive_simulation() does not
    • simulate() depends on "maximum_generations" for its generation count, whereas revive_simulation() depends on "extend_gen"
  2. It seems that the largest contrast among the two would be how they prepare the simulation (creation of simulation parameters, functions, World and Populations).
  3. Re-factor both revive_simulation() (rename it to 'rev_simulate()') and simulate() to call simulation_core() that contains the common codes they use.

Completed. (See commit: e42bf57)

  1. simulate() and revive_simulation() now call on simulation_core() to run the main simulation.
  2. preparation of simulations now work in dose.py level, before calling simulation_core()