Is the path correct? Is the path correct ?

Given a string, your program must determine whether or not Alice can reach Bob, following the signs on the map. You must return a truthy or falsy value.

The input string will contain the following characters :


 (space) and \n. Only used for padding.
&gt;, &lt;, ^, v, are the "signs". They show the direction.
&amp;. Ignore next char, whatever it is (including spaces and Bob)
A and B respectively Alice and Bob.


The map is a torus. If Alice reaches the end of a row, then she is teleported back to the beginning of that row. Same applies for columns.

Examples

Given those examples as input, your program must return a truthy value (each input is separated with a - line):

A&gt;B
-----------------
&lt;BA
-----------------
A       B
-----------------
BA
-----------------
Av  &gt;B
 &gt;  ^
-----------------
Av
 B
-----------------
A&gt;v
  &gt;B
-----------------
A&gt;v&gt;   v&gt;B
 v&lt; &gt; &amp;&lt;^
 &gt; ^
-----------------
A&gt;v&gt;   v
 v&lt; &gt;B&amp;&lt;
 &gt; ^
-----------------
A&amp;&lt;B
-----------------
A&amp;B&lt;
-----------------
&lt;A       &amp;B


For the following, your program must output a falsy value or nothing :

AvB
-----------------
A&amp;B
-----------------
A&gt;&lt;B
-----------------
A&gt;v
 ^&lt;B


Path viewer

You can have a visual representation of the input here. Thanks to arnemart for this.

Some rules


The input may be padded with spaces to form a rectangle
Initially, Alice goes straight forward (from above, she goes to the right)
Your program should handle infinite loop cases (see Hint)
A is not always the first character, as you may have seen, however, you may write a program that handles only input with A being the first char, but 20 bytes will be added to your score.
A map (the input) is considered invalid in case there are other characters than those specified above. Your program won't have to handle them.
This is code-golf, so shortest code in bytes wins.


Hint

Your program will most likely be a loop, unless you find a more mathematical solution to this challenge. To handle infinite path, I recommend using a finite loop (e.g for) instead of a potentially infinite one (e.g while). 

Therefore, the maximum iteration of the loop I can think of (I did not do any maths, any correction is welcome) is (length of input)*4
C, 250 bytes
#define h x=(j+x-1+d%3)%j,i=(j+i+(d=='v')-(d==94))%j
char a[999],b[999];x,i,d=2,k,f;main(j){for(;gets(a+j*i);)j=strlen(a+j*i++);for(x=strchr(a,65)-a,i=x/j,x=x%j;!k*d;h)k|=b[f=j*i+x]&amp;1&lt;&lt;d%5,b[f]|=1&lt;&lt;d%5,(f=a[f])&amp;16?d=f:f&amp;4?h:f&amp;2?d=0:0;putchar(48+!k);}

This also requires that the input is padded with spaces.
Ungolfed:
#define h x=(j+x-1+d%3)%j,i=(j+i+(d=='v')-(d==94))%j 
char a[999],b[999];x,i,d=2,k,f;
main(j){
 for(;gets(a+j*i);)j=strlen(a+j*i++); //read lines and determine line length
 for(x=strchr(a,65)-a,i=x/j,x=x%j;    //the current position is 'A'
 !k*d; //as long as we have not arrived at 'B' 
       //and not travelled through the same cell and in the same direction twice
 h)    //advance one in the current direction
   k|=b[f=j*i+x]&amp;1&lt;&lt;d%5,b[f]|=1&lt;&lt;d%5,  //if we have already travelled  
                                       //through this cell in this direction
   (f=a[f])&amp;16?d=f //change direction if this cell is one of &lt;&gt;^v
   :f&amp;4?h          //if this cell is '&amp;', advance one in the current direction
   :f&amp;2?d=0:0;     //if we have reached 'B'
 putchar(48+!k);
}