Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void moveRobot(RobotConnectionManager robotConnectionManager, int toX, int toY) {
- RobotConnection rc = null;
- boolean s = false;
- for(int i = 0; i < 2; i++)
- {
- try
- {
- rc = robotConnectionManager.getConnection();
- rc.moveRobotTo(toX, toY);
- s = true;
- break;
- }
- catch (RobotConnectionException e)
- {
- continue;
- }
- finally
- {
- if(rc != null)
- rc.close();
- }
- }
- if(!s) {
- try
- {
- rc = robotConnectionManager.getConnection();
- rc.moveRobotTo(toX, toY);
- }
- finally
- {
- if(rc != null)
- rc.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement