package com.qualcomm.ftcrobotcontroller;

import java.util.Calendar;

/**
 * Created by Simon on 12/31/2015.
 */

public class AutoState extends RMOpMode {
    final int END = 0;
    final int MOVEFORWARD = 1;
    final int MOVEBACKWARD = 2;
    final int TURNLEFT = 3;
    final int TURNRIGHT = 4;
    final int WAIT = 5;

    @Override
    public void init() {
        super.init();
    }

    public void calculate() {
        int state = 5;
        while (state != END) {
            switch (state) {
                case MOVEFORWARD:
                    System.out.println("Moving forward");
                    motorMap.get("DriveLeftOne").setDesiredPower(1.0);
                    motorMap.get("DriveLeftTwo").setDesiredPower(1.0);
                    motorMap.get("DriveRightOne").setDesiredPower(1.0);
                    motorMap.get("DriveRightTwo").setDesiredPower(1.0);

                    state = STATE2;

                    if (someQuitCheck == true) state = QUIT;

                    break;
                case STATE2:
                    System.out.println("Doing Task 2");

   /* Check conditions and possibly modify state */

                    state = STATE1;

                    if (someQuitCheck == true) state = QUIT;
                    break;
                default:
                    break;
            } // end switch

        } // end while
    }
}
@@ -157,170 +157,38 @@
     
-final int END = 0;%0A    final int MOVEFORWARD = 1;%0A    final int MOVEBACKWARD = 2;%0A    final int TURNLEFT = 3;%0A    final int TURNRIGHT = 4;%0A    final int WAIT = 5;
+private String state = %22begin%22
 %0A%0A  
@@ -295,82 +295,129 @@
     
-int 
+while (
 state 
+!
 = 
-5;%0A        while (state != END) %7B%0A            switch (state) %7B
+%22end%22) %7B%0A            switch (state) %7B%0A                case %22begin%22:%0A                    state = %22center%22;
 %0A   
@@ -438,19 +438,16 @@
 ase 
-MOVEFORWARD
+%22center%22
 :%0A  

Add string case