You walk a certain path often from point A to point B which is 3 miles direct line. However, your path is obstructed randomly by a magic wall force field which extends 1 mile (in both directions) perpendicular to your path of travel between A and B. Your can think of those force field endpoints as C and D. So imagine a wide plus shape such that the wide part is the path you want to walk optimally (shortest possible case) but the perpendicular part of the force field is the part you have to walk around when it is present. The roughly plus shape is what it would look like if viewed from a plane looking on the ground at the shape points A,B,C and D make if the force field is present.
The rules are as follows:
You cannot detect the presence of the forcefield until you are right at it, at which point you could continue walking if it is not present or MUST walk around it if present. It will not disappear if you just wait there and you cannot just step over it. Once you successfully walk around it, it will then disappear (but may come back next walk).
You must walk only in straight line segments between A and B. You cannot follow a curved route for example like a semicircle shape path.
The forcefield appears randomly like the flip of a coin so on average it will be there 50%.
You cannot backtrack your path, you always make an effort to walk with B as your destination.
The force field will appear only at the midpoint between A and B which is 1.5 miles from both A and B. Your path will be marked at this point so you don't "crash" into the force field. You can simply stop at that point and test if the force field is present. It will only first appear (for that particular walk) when you are standing at this very small point along the path.
So the questions are what path do you take to minimize the walking distance on average? What will be that minimum average distance?
Actually I was in a big hurry when I asked this question. Originally, the forcefield wall was supposed to be exactly midway between A and B but by forgetting to post that piece of information, it actually made the question more interesting. But for the sake of this question, assume it is midway between A and B each time it appears.