Skip to content

Instantly share code, notes, and snippets.

@e-tverdokhleb
Created November 16, 2015 03:49
Show Gist options
  • Save e-tverdokhleb/2b0a863b6d867499374f to your computer and use it in GitHub Desktop.
Save e-tverdokhleb/2b0a863b6d867499374f to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
System.out.println(getQuadrant("a", "1"));
}
static String getQuadrant(String v, String h) { // means that input data is correct
String str_v = "abcdefghi";
return (Integer.valueOf(h) * 64) + "_" + (str_v.indexOf(v) + 1) * 64;
}
}
@liuiv15
Copy link

liuiv15 commented Nov 16, 2015

Согласно Вашей программе, Вы определяете не координаты верхнего левого угла заданного квадранта, а координаты следующего по диагонали квадранта.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment