Buggy code:
public class GameMap { private static GameMap singleton = null ; public static boolean [ ] [ ] walls ; public static char [ ] [ ] goals ; public static char [ ] [ ] boxes ; public static char [ ] [ ] agents ; public static int agentsAmount ; public ArrayList < Goal > unsolvedGoals ; private static int MAX_ROW ; private static int MAX_COLUMN ; public static Map < Character , String > colors = new HashMap < Character , String > ( ) ; public static ArrayList < ArrayList < Position > > boxPositionsFrom = new ArrayList < ArrayList < Position > > ( ) ; public static ArrayList < ArrayList < Position > > boxPositionsTo = new ArrayList < ArrayList < Position > > ( ) ; public static ArrayList < ArrayList < Position > > agentPositionsFrom = new ArrayList < ArrayList < Position > > ( ) ; public static ArrayList < ArrayList < Position > > agentPositionsTo = new ArrayList < ArrayList < Position > > ( ) ; public static ArrayList < Character > boxCharacters = new ArrayList < Character > ( ) ; public static ArrayList < Character > agentCharacters = new ArrayList < Character > ( ) ; public static ArrayList < Map < Position , Move > > timeController ; public static ArrayList < ArrayList < Plan > > plans ; public static JobManager jobManager = new JobManager ( ) ; public static Storage storage ; private GameMap ( ) { } public static void addPlanToController ( Plan plan ) { } public static void evaluatePlans ( ArrayList < Plan > plans ) { } public static int comparePlans ( Plan a , Plan b ) { } public static void updateTimeController ( ) { } public static boolean isPositionOccupiedToTime ( Position p , int time ) { } public static int cellFreeIn ( int currentTime , Position pos ) { } public static void printMasterPlan ( ) { for ( int i = 0 ; i < ( GameMap . agentsAmount ) ; i ++ ) { } boolean done = false ; int count = 0 ; int time = 0 ; String cmd = "" ; int [ ] currentPlan = new int [ GameMap . agentsAmount ] ; for ( int i = 0 ; i < ( GameMap . agentsAmount ) ; i ++ ) { currentPlan [ i ] = 0 ; } while ( ! done ) { count = 0 ; cmd = "[" ; for ( int t = 0 ; t < ( GameMap . agentsAmount ) ; t ++ ) { if ( ( GameMap . plans . get ( t ) . size ( ) ) > ( currentPlan [ t ] ) ) { Move m = GameMap . plans . get ( t ) . get ( currentPlan [ t ] ) . getMoveToTime ( time ) ; if ( m != null ) cmd += m . toString ( ) ; else { cmd += "NoOp" ; count ++ ; } cmd += "," ; } else { cmd += "NoOp" ; cmd += "," ; } } cmd = GameMap . removeLastChar ( cmd ) ; cmd += "]" ; if ( ( cmd . length ( ) ) == 1 ) { done = true ; } else { System . out . println ( cmd ) ; System . out . flush ( ) ; } <START_BUG> if ( ( count >= ( GameMap . agentsAmount ) ) || ( time >= 50 ) ) <END_BUG> done = true ; time ++ ; for ( int t = 0 ; t < ( GameMap . agentsAmount ) ; t ++ ) { if ( ( ( GameMap . plans . get ( t ) . size ( ) ) > ( currentPlan [ t ] ) ) && ( ( GameMap . plans . get ( t ) . get ( currentPlan [ t ] ) . subplans . get ( ( ( GameMap . plans . get ( t ) . get ( currentPlan [ t ] ) . subplans . size ( ) ) - 1 ) ) . stop ) < time ) ) { ( currentPlan [ t ] ) ++ ; } } if ( time > 100000 ) { } } } public static String removeLastChar ( String s ) { } public static GameMap getInstance ( ) { } private static void error ( String msg ) throws Exception { } public static int [ ] size ( ) { } public static Goal getUnsolvedGoal ( ) { } public static Boolean isCellFree ( Position pos ) throws Exception { } public static Boolean isWall ( Position pos ) throws Exception { } public static char BoxAt ( Position pos ) { } public static char boxAtTime ( Position pos , int time ) { } public static char GoalAt ( Position pos ) { } public static char AgentAt ( Position pos ) { } public static Position agentPositionAtTime ( int ID , int time ) throws Exception { } public static char agentAtTime ( Position pos , int time ) { } protected void read ( BufferedReader serverMessages ) throws Exception { } }

Fix:
if ( ( count >= ( GameMap . agentsAmount ) ) || ( time >= 50000 ) )