import java.util.Random;
public class Driver {
  public static void main(String[] args) {
    Sequence testSeq = new Sequence();
    Random rand = new Random();
    for (int i = 0; i <= 10; i++) {
      int cycleStart = testSeq.generateRandomSequence(20000, rand.nextBoolean());
      Runtime.getRuntime().gc();
      long befmem = Runtime.getRuntime().freeMemory();
      int guess = CycleDetector.detectCycle(testSeq);
      long aftmem = Runtime.getRuntime().freeMemory();


      if (i != 0) {
        System.out.print(i + ") ");
        if (cycleStart == guess) {
          System.out.println("Cycle identified correctly.");
        } else {
          System.out.println("Cycle identified incorrectly.");
        }

        if (befmem - aftmem > 10) {
          System.out.println("  ERROR: Memory usage exceeded");
        }
      }
    }
  }
}
