import java.util.Vector;

public class Verifier {
    private static final String EXAMPLE1_FILE = "example1.txt";
    private static final int EXAMPLE1_STEPS = 8;
    private static final String EXAMPLE2_FILE = "example2.txt";
    private static final int EXAMPLE2_STEPS = 86;
    private static final String EXAMPLE3_FILE = "example3.txt";
    private static final int EXAMPLE3_STEPS = 132;
    private static final String EXAMPLE4_FILE = "example4.txt";
    private static final int EXAMPLE4_STEPS = 136;

    public Verifier(boolean debug) {
        _debug = debug;
    }

    public boolean verify() {
        Vector<String> input = Util.readMap(EXAMPLE1_FILE);
        Map theMap = new Map(input, _debug);

        System.out.println(theMap);

        Explorer exp = new Explorer(theMap, _debug);

        System.out.println("Number of keys and doors: " + theMap.numberOfKeys() + ", " + theMap.numberOfDoors());

        System.out.println("\nTraversing map ...");

        int steps = exp.findAllKeys();

        if (steps != EXAMPLE1_STEPS) {
            System.out.println("Error for " + EXAMPLE1_FILE + " - number of steps: " + steps);

            return false;
        }

        System.out.println("Verified. Number of steps to find all keys: " + steps);

        input = Util.readMap(EXAMPLE2_FILE);

        theMap = new Map(input, _debug);

        System.out.println("\n" + theMap);

        exp = new Explorer(theMap, _debug);

        System.out.println("Number of keys and doors: " + theMap.numberOfKeys() + ", " + theMap.numberOfDoors());

        System.out.println("\nTraversing map ...");

        steps = exp.findAllKeys();

        if (steps != EXAMPLE2_STEPS) {
            System.out.println("Error for " + EXAMPLE2_FILE + " - number of steps: " + steps);

            return false;
        }

        System.out.println("Verified. Number of steps to find all keys: " + steps);

        input = Util.readMap(EXAMPLE3_FILE);

        theMap = new Map(input, _debug);

        System.out.println("\n" + theMap);

        exp = new Explorer(theMap, _debug);

        System.out.println("Number of keys and doors: " + theMap.numberOfKeys() + ", " + theMap.numberOfDoors());

        System.out.println("\nTraversing map ...");

        steps = exp.findAllKeys();

        if (steps != EXAMPLE3_STEPS) {
            System.out.println("Error for " + EXAMPLE3_FILE + " - number of steps: " + steps);

            return false;
        }

        System.out.println("Verified. Number of steps to find all keys: " + steps);

        input = Util.readMap(EXAMPLE4_FILE);

        theMap = new Map(input, _debug);

        System.out.println("\n" + theMap);

        exp = new Explorer(theMap, _debug);

        System.out.println("Number of keys and doors: " + theMap.numberOfKeys() + ", " + theMap.numberOfDoors());

        System.out.println("\nTraversing map ...");

        steps = exp.findAllKeys();

        if (steps != EXAMPLE4_STEPS) {
            System.out.println("Error for " + EXAMPLE4_FILE + " - number of steps: " + steps);

            return false;
        }

        System.out.println("Verified. Number of steps to find all keys: " + steps);

        input = Util.readMap(EXAMPLE5_FILE);

        theMap = new Map(input, _debug);

        System.out.println("\n" + theMap);

        exp = new Explorer(theMap, _debug);

        System.out.println("Number of keys and doors: " + theMap.numberOfKeys() + ", " + theMap.numberOfDoors());

        System.out.println("\nTraversing map ...");

        steps = exp.findAllKeys();

        if (steps != EXAMPLE5_STEPS) {
            System.out.println("Error for " + EXAMPLE5_FILE + " - number of steps: " + steps);

            return false;
        }

        System.out.println("Verified. Number of steps to find all keys: " + steps);

        return true;
    }

    private boolean _debug;
}
@@ -40,17 +40,17 @@
 Verifier
- 
+%0A
 %7B%0A    pr
@@ -270,10 +270,10 @@
 S = 
-86
+24
 ;%0A  
@@ -380,17 +380,16 @@
 STEPS = 
-1
 32;%0A    
@@ -498,11 +498,10 @@
 S = 
-136
+72
 ;%0A%0A 
@@ -533,16 +533,20 @@
 n debug)
+%0A   
  %7B%0A     
@@ -598,16 +598,20 @@
 verify()
+%0A   
  %7B%0A     
@@ -1042,24 +1042,32 @@
 MPLE1_STEPS)
+%0A       
  %7B%0A         
@@ -1688,24 +1688,32 @@
 MPLE2_STEPS)
+%0A       
  %7B%0A         
@@ -2334,24 +2334,32 @@
 MPLE3_STEPS)
+%0A       
  %7B%0A         
@@ -2980,24 +2980,32 @@
 MPLE4_STEPS)
+%0A       
  %7B%0A         
@@ -3217,646 +3217,8 @@
 );%0A%0A
-        input = Util.readMap(EXAMPLE5_FILE);%0A%0A        theMap = new Map(input, _debug);%0A%0A        System.out.println(%22%5Cn%22 + theMap);%0A%0A        exp = new Explorer(theMap, _debug);%0A%0A        System.out.println(%22Number of keys and doors: %22 + theMap.numberOfKeys() + %22, %22 + theMap.numberOfDoors());%0A%0A        System.out.println(%22%5CnTraversing map ...%22);%0A%0A        steps = exp.findAllKeys();%0A%0A        if (steps != EXAMPLE5_STEPS) %7B%0A            System.out.println(%22Error for %22 + EXAMPLE5_FILE + %22 - number of steps: %22 + steps);%0A%0A            return false;%0A        %7D%0A%0A        System.out.println(%22Verified. Number of steps to find all keys: %22 + steps);%0A%0A
     

Update Verifier.java