Ok then, I see your issue now.
Ok, one way to do this, would be to devise a recursive flood-fill algorithm starting at your player. The flood fill would keep track of "depth", which is essentially the number of steps it would take to reach a specific point. The flood fill would end once the depth exceeds the maximum number of steps the player could walk (6 in your case).
Keep in mind if you did this method, you'd need an extra array (or add another dimension to your map array) that keeps track of which spaces in the flood fill have been visited (this will essentially be an array storing which spaces are legal moves).
Something like the following code might work (note again I'm assuming that a mapArray(x,y) value of 0 is a "walkable" cell, and 1 is a solid "unwalkable" cell):
function FloodFill(x, y, depth, maxDepth)
if depth = 0 then ClearFloodFill()
floodFillVisited(x, y) = 1
if depth<maxDepth
if mapArray(x-1, y) = 0 then FloodFill(x-1, y, depth+1, maxDepth)
if mapArray(x+1, y) = 0 then FloodFill(x+1, y, depth+1, maxDepth)
if mapArray(x, y-1) = 0 then FloodFill(x, y-1, depth+1, maxDepth)
if mapArray(x, y+1) = 0 then FloodFill(x, y+1, depth+1, maxDepth)
endif
endfunction
function ClearFloodFill()
for x = 0 to 16 //Max width of your level
for y = 0 to 16 //Max height of your level
floodFillVisited(x, y) = 0
next y
next x
endfunction
Then, anytime you want to generate a list of legal moves for the player, you'd call: "FloodFill(playerX, playerY, 0, 6)"
You could then check the array "floodFillVisited(x, y)" to see if any given x,y space is a move the player can access in no more than six steps, without walking through obstacles.