private int numAdjacentFlags(final int col, final int row)
    {
        int neighbourFlags = 0;
        
        // For each surrounding tile
        for (int i=col-1; i<=col+1; i++) {
        for (int j=row-1; j<=row+1; j++)
        {
            if ( ! (i<0 || j<0 || i>=this.width || j>=this.height) //neighbour tile not out of grid
                && ! (i==col && j==row)) //tile not the center (original) tile itself
            {
                if (tile[i][j].isFlagged())
                {
                    neighbourFlags++;
                }
            }
        }
        }
        
        return neighbourFlags;
    }