public static void tryBFSNextTurn() throws GameActionException { if (BFSIdle >= 50) { // if idle for 50 turns or more // we retry destination setupGetCloser(destination); } else { // System.out.println("BFS length: " + BFSTurns.length); // System.out.println("Direction: " + BFSTurns[BFSRound]); Direction dir = Direction.values()[BFSTurns[BFSRound]]; boolean hasMoved = NavSystem.moveOrDefuse(dir); if (hasMoved) { BFSRound++; } else { BFSIdle++; } } }