import java.io.*;

public class CircuitBoard
{
    public static final String SEPARATOR = ",";
    
    public static void main (String[] args)
    {
        boolean debug = false;
        boolean dump = false;
        boolean runVerifier = false;
        int target = 19690720;

        for (int i = 0; i < args.length; i++)
        {
            if ("-help".equals(args[i]))
            {
                System.out.println("[-value target] [-help] [-verify] [-debug] [-dump]");
                System.exit(0);
            }
            
            if ("-verify".equals(args[i]))
                runVerifier = true;

            if ("-debug".equals(args[i]))
                debug = true;

            if ("-dump".equals(args[i]))
                dump = true;

            if ("-value".equals(args[i]))
                target = Integer.parseInt(args[i+1]);
        }

        /*
         * Create the computer which will do the real work.
         */

        _theComputer = new Intcode(debug);

        if (runVerifier)
        {
            Verifier theVerifier = new Verifier(_theComputer, debug);

            theVerifier.verify();
            System.exit(0);
        }

        /*
         * Open the data file and read it in.
         */

        BufferedReader reader = null;
        String[] values = null;

        try
        {
            reader = new BufferedReader(new FileReader(DATA_FILE));
            String line = null;

            while ((line = reader.readLine()) != null)
            {
                values = line.split(Intcode.DELIMITER);

                if (dump)
                    dumpData(values);
                else
                {
                    resetState(values, debug);  // not really needed for this part.

                    Cruncher bruteForce = new Cruncher(_theComputer, values, debug);

                    String[] results = bruteForce.crunch(target);

                    if (results != null)
                    {
                        System.out.println("To achieve the target of "+target+" requires a noun of "+results[0]+" and a verb of "+results[1]);

                        int total = 100 * Integer.parseInt(results[0]) + Integer.parseInt(results[1]);

                        System.out.println("And the answer is: "+total);
                    }
                    else
                        System.out.println("Could not achieve the target of "+target);
                }
            }
        }
        catch (Throwable ex)
        {
            ex.printStackTrace();
        }
        finally
        {
            try
            {
                reader.close();
            }
            catch (Throwable ex)
            {
            }
        }
    }

    private static final void dumpData (String[] values)
    {
        for (String str : values)
        {
            System.out.println(str);
        }
    }

    private static final String DATA_FILE = "data.txt";
}
@@ -88,20 +88,101 @@
  = %22,%22;%0A
+%0A
     
+public static final int LENGTH = 1000;%0A    public static final int WIDTH = 1000;
 %0A    pub
@@ -240,21 +240,22 @@
 boolean 
-debug
+verify
  = false
@@ -289,76 +289,8 @@
 lse;
-%0A        boolean runVerifier = false;%0A        int target = 19690720;
 %0A%0A  
@@ -438,24 +438,8 @@
 ln(%22
-%5B-value target%5D 
 %5B-he
@@ -455,17 +455,8 @@
 ify%5D
- %5B-debug%5D
  %5B-d
@@ -585,574 +585,92 @@
     
-runVerifier = true;%0A%0A            if (%22-debug%22.equals(args%5Bi%5D))%0A                debug = true;%0A%0A            if (%22-dump%22.equals(args%5Bi%5D))%0A                dump = true;%0A%0A            if (%22-value%22.equals(args%5Bi%5D))%0A                target = Integer.parseInt(args%5Bi+1%5D);%0A        %7D%0A%0A        /*%0A         * Create the computer which will do the real work.%0A         */%0A%0A        _theComputer = new Intcode(debug);%0A%0A        if (runVerifier)%0A        %7B%0A            Verifier theVerifier = new Verifier(_theComputer, debug);%0A%0A            theVerifier.verify();%0A            System.exit(0)
+verify = true;%0A%0A            if (%22-dump%22.equals(args%5Bi%5D))%0A                dump = true
 ;%0A  
@@ -803,22 +803,52 @@
 tring%5B%5D 
-values
+line1 = null;%0A        String%5B%5D line2
  = null;
@@ -1061,390 +1061,211 @@
     
-values = line.split(Intcode.DELIMITER);%0A%0A                if (dump)%0A                    dumpData(values);%0A                else%0A                %7B%0A                    resetState(values, debug);  // not really needed for this part.%0A%0A                    Cruncher bruteForce = new Cruncher(_theComputer, values, debug);%0A%0A                    String%5B%5D results = bruteForce.crunch(target
+if (line1 == null)%0A                    line1 = line.split(SEPARATOR);%0A                else%0A                %7B%0A                    if (line2 == null)%0A                        line2 = line.split(SEPARATOR
 );%0A
-%0A
     
@@ -1284,28 +1284,12 @@
     
-if (results != null)
+else
 %0A   
@@ -1355,212 +1355,90 @@
 ln(%22
-To achieve the target of %22+target+%22 requires a noun of %22+results%5B0%5D+%22 and a verb of %22+results%5B1%5D);%0A%0A                        int total = 100 * Integer.parseInt(results%5B0%5D) + Integer.parseInt(results%5B1%5D
+Unexpected extra lines in input file!%22);%0A%0A                        System.exit(0
 );%0A
-%0A
     
@@ -1457,65 +1457,10 @@
     
-    System.out.println(%22And the answer is: %22+total);%0A    
+%7D%0A
     
@@ -1473,32 +1473,39 @@
       %7D%0A        
+    %7D%0A%0A
             else
@@ -1492,36 +1492,41 @@
  %7D%0A%0A            
-else
+if (dump)
 %0A               
@@ -1530,78 +1530,48 @@
     
-        System.out.println(%22Could not achieve the target of %22+target);
+dumpData(line1, line2);%0A            else
 %0A   
@@ -1571,37 +1571,33 @@
 lse%0A            
-    %7D
+%7B
 %0A            %7D%0A 
@@ -1921,22 +1921,208 @@
 g%5B%5D 
-values)%0A
+line1, String%5B%5D line2)%0A    %7B%0A        System.out.println(%22Wire 1:%22);%0A        for (String str : line1)%0A  
     
+  
 %7B%0A
+            System.out.println(str);%0A        %7D%0A%0A        System.out.println(%22%5CnWire 2:%22);%0A
     
@@ -2147,14 +2147,13 @@
 r : 
-values
+line2
 )%0A  

Update CircuitBoard.java