×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Dorian Cuentas
Added: Jul 17, 2015 9:04 PM
Views: 13
Tags: no tags
  1. public static char[] getValidCoords(char[][] grid, String[] challengeArray) {
  2.         char[] validCoords = new char[3];
  3.         int validCoordsArrayIndex = 0;
  4.         for (String challenge : challengeArray) {
  5.             char coord1 = challenge.charAt(0);
  6.             char coord2 = challenge.charAt(2);
  7.             int numericXCoord = (int) coord2 - UPPER_A_INT_VALUE;
  8.             int numericYCoord = Character.getNumericValue(coord1) - 1;
  9.             validCoords[validCoordsArrayIndex] = grid[numericYCoord][numericXCoord];
  10.             validCoordsArrayIndex++;
  11.         }
  12.         return validCoords;
  13.     }