Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. public static void moveRobot(RobotConnectionManager robotConnectionManager, int toX, int toY) {
  2.     RobotConnection a;
  3.     for(int i = 0; i < 3; i++)
  4.     {
  5.         try{
  6.              
  7.             a = robotConnectionManager.getConnection();
  8.             a.moveRobotTo(toX, toY);
  9.             if(i != 2)
  10.                 a = robotConnectionManager.getConnection();
  11.             break;
  12.         }
  13.         catch(RobotConnectionException e)
  14.         {
  15.             a.close();
  16.         }
  17.         catch(Exception e)
  18.         {
  19.             throw(e);
  20.             //break;
  21.         }
  22.         finally
  23.         {
  24.             a.close();
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement