Skip to content

Instantly share code, notes, and snippets.

@Lokutus
Created March 8, 2016 11:19
Show Gist options
  • Save Lokutus/d9bcd17586e60c04b001 to your computer and use it in GitHub Desktop.
Save Lokutus/d9bcd17586e60c04b001 to your computer and use it in GitHub Desktop.
public static void printPosition(double cell) {
int row = (int) ((cell / 9) + 1);
int col = (int) ((cell % 9) + 1);
int group = (((int) Math.ceil(row / 3.0)) * 3) - (3 - ((int) Math.ceil(col / 3.0)));
System.out.println(cell + " : " + row + " : " + col + " : " + group);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment