on-internet
← Community

How do I use enum to pass-in a position 1D array and output a preset position name?

Stack Overflow ·

How do I use enum to pass-in a position 1D array and output a preset position name (e.g. 1, 4 returns Town)? How can I smoothly set these values to my location names? How I'm doing it: public static String check(int x, int y){ if (x == 0 && y == 0){ //1,1 return "Home"; } else if ((x == 1 && y == 1) || //2,2 (x == 0 && y == 5) || //1,6 (x == 5 && y == 6)){ //6,7 return "Lake"; } else if ((x == 4 && y == 0) || //5,1 (x == 5 && y == 1) || //6,2 (x == 6 && y == 2) || //7,3 (x == 7 && y == 2)){ //8,3 return "River"; } else if ((x == 3 && y == 0) || //4,1 (x == 4 && y == 1) || //5,2 (x == 6 && y ==

Comments

Sign in or sign up to comment and upvote.

No comments yet.