Skip to content

Instantly share code, notes, and snippets.

@mrkschan
Created November 6, 2010 11:52
Show Gist options
  • Save mrkschan/665357 to your computer and use it in GitHub Desktop.
Save mrkschan/665357 to your computer and use it in GitHub Desktop.
public void gotoCoordinate(int x, int y)
{
// using Pythagoras' theorem to get the distance to travel
int goto_distance = (int) Math.sqrt(
(double) (x - robotX) * (x - robotX)
+ (double) (y - robotY) * (y - robotY)
);
:
:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment