Skip to content

Instantly share code, notes, and snippets.

@brand-it
Created August 27, 2011 06:29
Show Gist options
  • Save brand-it/1175068 to your computer and use it in GitHub Desktop.
Save brand-it/1175068 to your computer and use it in GitHub Desktop.
This is a basic distance calculation for game. Was testing out how accurate the data that is returned from numbers. Seams to be very good.
public class Start {
public static void main(String args[]) {
System.out.println("x, y: " + (7 - 6) + ", " + (3 - 4));
System.out.println((Math.pow((7 - 6), 2) + Math.pow((3 - 4), 2)));
System.out.println("x, y: " + (7 - 6) + ", " + (3 - 2));
System.out.println((Math.pow((7 - 6), 2) + Math.pow((3 - 2), 2)));
System.out.println("x, y: " + (7 - 8) + ", " + (3 - 4));
System.out.println((Math.pow((7 - 8), 2) + Math.pow((3 - 4), 2)));
System.out.println("x, y: " + (7 - 8) + ", " + (3 - 2));
System.out.println((Math.pow((7 - 8), 2) + Math.pow((3 - 2), 2)));
System.out.println("x, y: " + (7 - 5) + ", " + (3 - 5));
System.out.println((Math.pow((7 - 5), 2) + Math.pow((3 - 5), 2)));
System.out.println("x, y: " + (7 - 6) + ", " + (3 - 2));
System.out.println((Math.pow((7 - 6), 2) + Math.pow((3 - 2), 2)));
System.out.println("x, y: " + (7 - 8) + ", " + (3 - 4));
System.out.println((Math.pow((7 - 8), 2) + Math.pow((3 - 4), 2)));
System.out.println("x, y: " + (7 - 8) + ", " + (3 - 2));
System.out.println((Math.pow((7 - 8), 2) + Math.pow((3 - 2), 2)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment