public Dictionary <string, GameObject> GetAdjacents(GameObject tile) { // Create a dictionary to hold the adjacent game objects Dictionary <string, GameObject> adjacents = new Dictionary <string, GameObject> (); // Get the index of the given tile System.Tuple <int, int> index = tiles.Index(tile); int row = index.Item1; int col = index.Item2; // Check top if (row - 1 >= 0) { adjacents.Add("T", tiles [row - 1, col]); } // Check right if (col + 1 < cols) { adjacents.Add("R", tiles[row, col + 1]); } // Check bottom if (row + 1 < rows) { adjacents.Add("B", tiles[row + 1, col]); } // Check left if (col - 1 >= 0) { adjacents.Add("L", tiles[row, col - 1]); } return(adjacents); }