import java.util.*;

public class Computer
{
    public Computer (boolean debug)
    {
        _debug = debug;
    }

    public Vector<OpCode> fix (Vector<OpCode> instructions)
    {
        boolean done = false;

        try
        {
            Vector<OpCode> attempt = new Vector<OpCode>();

        }
        catch (ArrayIndexOutOfBoundsException ex)
        {
            // if we fix the program then we'll drop off the end of the program
        }

        return null;
    }

    public int executeUntilInfiniteLoop (Vector<OpCode> instructions)
    {
        int index = 0;
        OpCode op = instructions.elementAt(index);
        int accumulator = 0;

        while (!op.visited())
        {
            if (_debug)
            {
                System.out.println("\nInstruction: "+index);
                System.out.println("Accumulator: "+accumulator+"\n");
            }

            switch (op.type())
            {
                case OpCode.ACCUMULATOR:
                {
                    int value = ((Accumulator) op).getValue();

                    if (_debug)
                        System.out.println("acc: adding "+value+" to accumulator "+accumulator);

                    accumulator += value;
                    index++;
                }
                break;
                case OpCode.JUMP:
                {
                    int value = ((Jump) op).getStep();

                    if (_debug)
                        System.out.println("jmp: adding "+value+" to index "+index);

                    index += ((Jump) op).getStep();
                }
                break;
                case OpCode.NOOP:
                default:
                {
                    // no op!!

                    if (_debug)
                        System.out.println("nop");

                    index++;
                }
                break;
            }

            op.visit();

            op = instructions.elementAt(index);
        }

        return accumulator;
    }

    private int changeCode (Vector<OpCode> instructions, Vector<OpCode> copy, int entry)
    {
        int index = 0;
        Enumeration<OpCode> iter = instructions.elements();

        while (iter.hasMoreElements())
        {
            OpCode oc = iter.nextElement();

            switch (oc.type())
            {
                OpCode.ACCUMULATOR:
                {

                }
                break;
                OpCode.JUMP:
                {

                }
                break;
                default:
                {

                }
                break;
            }
        }

        return index;
    }

    private boolean _debug;
}
@@ -2001,32 +2001,111 @@
 mulator;%0A    %7D%0A%0A
+    // either a jmp is supposed to be a nop, or a nop is supposed to be a jmp%0A%0A
     private int 
@@ -2355,24 +2355,63 @@
 xtElement();
+%0A            OpCode replacement = null;
 %0A%0A          
@@ -2457,24 +2457,29 @@
             
+case 
 OpCode.ACCUM
@@ -2496,32 +2496,151 @@
               %7B%0A
+                    Accumulator a = (Accumulator) oc;%0A%0A                    replacement = new Accumulator(a.getValue());
 %0A               
@@ -2677,24 +2677,29 @@
             
+case 
 OpCode.JUMP:
@@ -2721,93 +2721,524 @@
   %7B%0A
-%0A                %7D%0A                break;%0A                default:%0A                %7B%0A
+                    Jump j = (Jump) oc;%0A%0A                    if (index == entry)%0A                    %7B%0A                        replacement = new NoOp(j.getStep());%0A                    %7D%0A%0A                    index++;%0A                %7D%0A                break;%0A                default:%0A                %7B%0A                    NoOp n = (NoOp) oc;%0A%0A                    if (index == entry)%0A                    %7B%0A                        replacement = new Jump(n.getValue());%0A                    %7D%0A%0A                    index++;
 %0A   

Update Computer.java