Created
February 17, 2016 14:56
-
-
Save alexejVasko/9ed46cc7ba2291a39916 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package tanks; | |
public class GetQuadrant { | |
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