Skip to content

Instantly share code, notes, and snippets.

@ilya-afanasev
Created September 23, 2016 14:40
Show Gist options
  • Save ilya-afanasev/1215340985c128165cd27183b72f7dad to your computer and use it in GitHub Desktop.
Save ilya-afanasev/1215340985c128165cd27183b72f7dad to your computer and use it in GitHub Desktop.
java
public static void moveRobot(RobotConnectionManager robotConnectionManager, int toX, int toY) {
for(int i = 0; i < 3; ++i){
try(RobotConnection conn = robotConnectionManager.getConnection();){
conn.moveRobotTo(toX, toY);
return;
}catch(RobotConnectionException ex){}
}
throw new RobotConnectionException("Close connection");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment