for ( int nextId = game.getNextEntityNum(getLocalPlayer(), entNum);
for ( int nextId = game.getNextEntityNum(entNum);
     public void calculateMoveTurn()     {        // for each of my units that haven't moved yet,        // figure out what the best move would be.                  // then take the move with the lowest absolute value         // and do it first.         int entNum = game.getFirstEntityNum(getLocalPlayer());         int first = entNum;	boolean infMoveLast = game.getOptions().booleanOption("inf_move_last");	boolean infMoveMulti = game.getOptions().booleanOption("inf_move_multi");         MoveOption opt = null;         int theEnt = -1;         do {	     // Are we moving a non-Infantry entity in	     // the middle of an Infantry move block?	     if ( infMoveMulti && (turnInfMoved % Game.INF_MOVE_MULTI) > 0 &&		  !(game.getEntity(entNum) instanceof Infantry) ) {		 // Does this player still have infantry to move?		 if ( game.hasInfantry(this.local_pn) ) {		     // Yup.  Ignore this entity and check the next one.		     entNum = game.getNextEntityNum(getLocalPlayer(), entNum);		     continue;		 }		 else {		     // Nope.  Reset the infantry counter.		     turnInfMoved = 0;		 }	     } // End check-inf_move_multi	     // If infantry move last, and the current entity is Infantry, then	     // make sure that all other entities for the player have moved.	     else if ( infMoveLast && turnInfMoved == 0 &&		       (game.getEntity(entNum) instanceof Infantry) ) {		 // Walk through the list of entities for this player.		 for ( int nextId = game.getNextEntityNum(getLocalPlayer(), entNum);		       nextId != entNum;		       nextId = game.getNextEntityNum(getLocalPlayer(), nextId) ) {		     // If we find a non-Infantry entity,		     // move it instead, and stop looping.		     if ( !(game.getEntity(nextId) instanceof Infantry) ) {			 entNum = nextId;			 break;		     }		 } // Check the player's next entity.	     } // End check-inf_move_last            MoveOption mo = calculateBestMove(entNum);            sendChat("Could move " + game.getEntity(entNum).getShortName() + " with " + mo.moves + ": dmg " + mo.damagePotential + ", threat " + mo.threat);            if (opt == null) {                opt = mo;                theEnt = entNum;            } else if (Math.abs(mo.value()) < Math.abs(opt.value())) {                opt = mo;                theEnt = entNum;            }            entNum = game.getNextEntityNum(getLocalPlayer(), entNum);         } while (entNum != -1 && entNum != first);         // If we're moving an infantry unit, increment the counter.	 if ( game.getEntity(theEnt) instanceof Infantry ) {	     turnInfMoved++;	 }         // okay, now we've got a move -- submit it         sendChat("Move " + game.getEntity(theEnt).getShortName() + ": " + opt.moves);                  moveEntity(theEnt, opt.moves);     }