package towersofhanoi;

import utils.Stopwatch;

abstract class ExecutionModel {
  private static final float NR_REPS = 1; //10000;
  private int nrDisks;
  ExecutionModel() {
  }
  ExecutionModel(int nrDisks) {
    this.nrDisks = nrDisks;
  }
  void pre() { }
  void cleanup() { }
  void doit() {
    Stopwatch stopwatch = new Stopwatch();
    stopwatch.start();
    
    int src = 1,  dst = 2,  aux = 3;
    for (int i = 0; i < NR_REPS-1; ++i) {
      hanoi(false, nrDisks, src, dst, aux);
    }
    hanoi(true, nrDisks, src, dst, aux);
    
    stopwatch.stop();
    System.out.println(".. Executing " + this.getClass().getName() + ": " +
            stopwatch.toValue()/NR_REPS + " ms");
  }
  abstract void hanoi(boolean flgDisplay, int nrDisks, int src, int dst, int aux);
}