import java.util.*;
import java.io.*;

public class Droid
{
    public Droid (Vector<String> values, boolean debug)
    {
        _theComputer = new Intcode(values, debug);
        _debug = debug;
    }

    /*
     * Move around automatically. TBD.
     */

    public void traverse ()
    {

    }

    public void stepTraverse ()
    {
        boolean finished = false;

        while (!finished)
        {
            System.out.println("here");

            _theComputer.executeUntilInput();

            LinkedList<String> outputs = _theComputer.getOutputs();
            String theOutput = Util.outputToString(outputs);

            System.out.println(theOutput);
            System.out.println(Commands.getCommands());

            String input = Util.getInput();

            int option;
            
            try
            {
                option = Integer.parseInt(input);
            }
            catch (Throwable ex)
            {
                option = 8;  // quit on error
            }

            System.out.println("option "+option);

            switch (option)
            {
                case 1:
                {
                    _theComputer.setInputs(Util.stringToInput(Commands.NORTH, "\n"));
                }
                break;
                case 2:
                {
                    _theComputer.setInputs(Util.stringToInput(Commands.SOUTH, "\n"));
                }
                break;
                case 3:
                {
                    _theComputer.setInputs(Util.stringToInput(Commands.EAST, "\n"));
                }
                break;
                case 4:
                {
                    _theComputer.setInputs(Util.stringToInput(Commands.WEST, "\n"));
                }
                break;
                case 5:
                {
                    System.out.println("Which item to pick up?");

                    String item = Util.getInput();

                    _theComputer.setInputs(Util.stringToInput(Commands.TAKE, item.trim()));

		            System.out.println("Picked up: " + item);
                }
                break;
                case 6:
                {
                    System.out.println("Which item to drop?");

                    String item = Util.getInput();

                    _theComputer.setInputs(Util.stringToInput(Commands.DROP, item.trim()));

		            System.out.println("Dropped: " + item);
                }
                break;
                case 7:
                {
                    _theComputer.setInputs(Util.stringToInput(Commands.INVENTORY, "\n"));
                }
                break;
                case 8:
                {
                    finished = true;
                }
                break;
                default:
                {
                    System.out.println("Unrecognised input: "+option);
                }
            }
        }
    }

    private Intcode _theComputer;
    private boolean _debug;
}
@@ -782,312 +782,21 @@
     
-int option;%0A            %0A            try%0A            %7B%0A                option = Integer.parseInt(input);%0A            %7D%0A            catch (Throwable ex)%0A            %7B%0A                option = 8;  // quit on error%0A            %7D%0A%0A            System.out.println(%22option %22+option);%0A%0A            switch (option
+switch (input
 )%0A  
@@ -832,9 +832,22 @@
 ase 
-1
+Commands.NORTH
 :%0A  
@@ -1014,9 +1014,22 @@
 ase 
-2
+Commands.SOUTH
 :%0A  
@@ -1196,9 +1196,21 @@
 ase 
-3
+Commands.EAST
 :%0A  
@@ -1376,9 +1376,21 @@
 ase 
-4
+Commands.WEST
 :%0A  
@@ -1556,9 +1556,21 @@
 ase 
-5
+Commands.TAKE
 :%0A  
@@ -1643,15 +1643,12 @@
  to 
-pick up
+take
 ?%22);
@@ -1832,17 +1832,13 @@
 ln(%22
-Picked up
+Taken
 : %22 
@@ -1912,9 +1912,21 @@
 ase 
-6
+Commands.DROP
 :%0A  
@@ -2270,9 +2270,26 @@
 ase 
-7
+Commands.INVENTORY
 :%0A  
@@ -2460,9 +2460,21 @@
 ase 
-8
+Commands.QUIT
 :%0A  
@@ -2676,14 +2676,13 @@
 : %22+
-option
+input
 );%0A 

Update Droid.java