private boolean tryToSpawn() { // check surrounding squares // spawn in one of them boolean spawned = false; if (allFriendlyRobots.length < GameConstants.MAX_ROBOTS) { shuffle(randomDirections); for (Direction direction : randomDirections) { if (rc.canMove(direction)) { try { log("Trying to spawn..."); rc.spawn(direction); log("Spwaned"); spawned = true; break; } catch (GameActionException e) { die(e); } } } } return spawned; }