Skip to content

Instantly share code, notes, and snippets.

@e-tverdokhleb
Created November 17, 2015 00:57
Show Gist options
  • Save e-tverdokhleb/3e4b20fcebd5564f49b8 to your computer and use it in GitHub Desktop.
Save e-tverdokhleb/3e4b20fcebd5564f49b8 to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
printCoordinates("b", "3");
}
/**
* -=TANKS=-
*/
static String getQuadrant(String v, String h) {
String str_v = "abcdefghi";
return (Integer.valueOf(h) * 64) + "_" + (str_v.indexOf(v) + 1) * 64;
}
static void printCoordinates(String v, String h) {
String coords = getQuadrant(v, h);
String a = coords.substring(0, coords.indexOf("_"));
String b = coords.substring(coords.indexOf("_") + 1);
System.out.println(v + h + ":(" + a + "px; " + b + "px" + ")");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment