import java.util.*;

public class VacuumRobot
{
    // instructions

    public static final String LEFT_COMMAND = "L";
    public static final String RIGHT_COMMAND = "R";

    private static final String INITIAL_INPUT = null;
    private static final String OVERRIDE_CODE = "2";

    private static final int OVERRIDE_LOCATION = 0;

    private static char SEPARATOR = ',';
    private static long SEPARATOR_ASCII = 44;
    private static long NEW_LINE_ASCII = 10;

    public VacuumRobot (Map map, Vector<String> instructions, boolean debug)
    {
        _theMap = map;
        _computer = new Intcode(instructions, INITIAL_INPUT, debug);
        _debug = debug;

        /*
         * "Force the vacuum robot to wake up by changing the value in your
         * ASCII program at address 0 from 1 to 2."
         * 
         * Should we check it's 1 before changing? Maybe add a test-and-set/override?
         */

        _computer.changeInstruction(OVERRIDE_LOCATION, OVERRIDE_CODE);
    }

    public void setMainMovementRoutine (String sequence)
    {
        char[] str = convertToAscii(sequence);

        System.out.println("adding "+str);

        _computer.setInput(str);
    }

    public void setFunctions (String funcA, String funcB, String funcC)
    {
        String funcAC = convertToAscii(funcA);
        String funcBC = convertToAscii(funcB);
        String funcCC = convertToAscii(funcC);

        System.out.println("adding "+funcAC+" "+funcBC+" "+funcCC);

        _computer.setInput(funcAC+funcBC+funcCC);
    }

    public void setContinuousVideo (boolean video)
    {
        if (video)
            _computer.setInput("y\n");
        else
            _computer.setInput("n\n");
    }

    public void sweep ()
    {
        _computer.executeProgram();
    }

    private long[] convertToAscii (String sequence)
    {
        long[] converted = new long[sequence.length()];
        char[] asArray = sequence.toCharArray();

        for (int i = 0; i < asArray.length; i++)
        {
            if (asArray[i] != SEPARATOR)
                converted[i] = (long) asArray[i];
            else
                converted[i] = SEPARATOR_ASCII;
        }

        return converted;
    }

    private Map _theMap;
    private Intcode _computer;
    private boolean _debug;
}
@@ -1063,18 +1063,24 @@
     
-char%5B%5D str
+long%5B%5D converted
  = c
@@ -1117,44 +1117,60 @@
     
-System.out.println(%22adding %22+str
+_computer.addInput(IntcodeUtil.convert(converted)
 );%0A
-%0A
     
@@ -1192,19 +1192,30 @@
 etInput(
-str
+NEW_LINE_ASCII
 );%0A    %7D
@@ -1298,30 +1298,30 @@
   %7B%0A        
-String
+long%5B%5D
  funcAC = co
@@ -1345,30 +1345,30 @@
 A);%0A        
-String
+long%5B%5D
  funcBC = co
@@ -1396,22 +1396,22 @@
         
-String
+long%5B%5D
  funcCC 
@@ -1448,69 +1448,159 @@
     
-System.out.println(%22adding %22+funcAC+%22 %22+funcBC+%22 %22+
+_computer.addInput(IntcodeUtil.convert(funcAC));%0A        _computer.setInput(NEW_LINE_ASCII);%0A%0A        _computer.addInput(IntcodeUtil.convert(
 func
-CC
+BC)
 );%0A
-%0A
     
@@ -1626,28 +1626,124 @@
 put(
-funcAC+funcBC+funcCC
+NEW_LINE_ASCII);%0A%0A        _computer.addInput(IntcodeUtil.convert(funcCC));%0A        _computer.setInput(NEW_LINE_ASCII
 );%0A 
@@ -1857,18 +1857,16 @@
 Input(%22y
-%5Cn
 %22);%0A    
@@ -1911,11 +1911,54 @@
 t(%22n
-%5Cn%22
+%22);%0A%0A        _computer.setInput(NEW_LINE_ASCII
 );%0A 

Update VacuumRobot.java