Skip to content

Commit

Permalink
Save new experiment on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
nusco committed Sep 6, 2015
1 parent 9077b1e commit 28fb7b1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/nusco/narjillos/application/PetriDish.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ public class PetriDish implements Dish {
public PetriDish(String version, CommandLineOptions options, int size) {
experiment = createExperiment(version, options, size);
experimentLog = new ExperimentLog(experiment.getId());
if (isNewExperiment(experiment))
experimentLog.save(experiment);
reportPersistenceOptions(options);
persistent = options.isPersistent();

System.out.println("Ticks:\tNarji:\tFood:");
}

private boolean isNewExperiment(Experiment experiment) {
return experiment.getTicksChronometer().getTotalTicks() == 0;
}

public Environment getEnvironment() {
return experiment.getEcosystem();
}
Expand Down

0 comments on commit 28fb7b1

Please sign in to comment.