Created
February 24, 2016 19:15
-
-
Save ilyaBrandon/f5635dc1978ff0085b5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BATTLEFRONT { | |
public static void main(String[] args) { | |
System.out.println(getQuadrant("a", "1")); | |
System.out.println(getQuadrant("a", "2")); | |
System.out.println(getQuadrant("b", "2")); | |
System.out.println(getQuadrant("i", "9")); | |
} | |
static String getQuadrant(String vert, String hor) { | |
String h = "123456789"; | |
String v = "abcdefghi"; | |
int quadrantSize = 64; | |
int x = h.indexOf(hor) * quadrantSize; | |
int y = v.indexOf(vert) * quadrantSize; | |
return x + "_" + y; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment