I'm not really giving a BFS solution, because I don't think that's necessary. You see, you'll always be able to walk in a tilted square:
O O O O O X X X O O
O O O O X X Z X X O
O O O O O X X X O O
O O O O O O X O O O
Like this, in case your starting position was the Z
. So basically you just have to find the tilted square with the highest sum.
As it happens, it's rather easy to write a formula whether a tile is included in the rhombus. It's just:
abs(<center_x>) + abs(<center_y>) >= abs(<checked_tile_x>) + abs(<checked_tile_y)
Then you'll solution will conclude two for loops for checking each tile as center tile, and another to which add the current tile to a temporary variable if, according to above formula, the current tile is in the rhombus.
Mind you that there are also ways to just walk over all tiles in the rhombus (which is far more efficient if K is a lot smaller than the square size). Something like:
for r from -K to K:
for c from -(K - abs(r)) to (K - abs(r)):
Point is <center_y> + r, <center_x> + c