Help Pac-Man count the Pac-Dots On the advice of Ms. Pac-Man who's worried about him getting overweight, Pac-Man has decided to keep track of his daily Pac-Dot intake. Help him count the number of Pac-Dots on a given path in the maze!
The maze

To help you build your own encoding of the maze, you can get some raw data here.
Pac-Man's journey
In the context of this challenge, the following rules apply:

First, the good news: the ghosts aren't there.
Pac-Man always starts his race at the position indicated on the above picture, heading to the East. There is no Pac-Dot at the starting position.
As long as he's following a straight path, he keeps advancing to the next squares.
When he encounters a 90° turn without any other available path (orange squares on the map), he automatically and systematically takes the turn.
When he encounters a junction where several paths are available (green squares on the map), he may either continue on the same direction -- if applicable -- or choose another direction (including doing a U-turn).
When Pac-Man passes through one of the exits on the middle left or middle right side of the maze, he immediately reappears on the opposite side.
Pac-Man eats all the Pac-Dots on the path he's following. Once a Pac-Dot has been eaten, it is removed from the maze.

The challenge
Input
You'll be given a string describing Pac-Man's behavior on the junctions that he's going to reach. This string will be made of the following characters:

L: do a 90° turn to the left
R: do a 90° turn to the right
F: go forwards (no direction change)
B: go backwards (do a U-turn)

When all characters have been processed, Pac-Man stops at the next junction he encounters.
Output
You have to print or output the number of Pac-Dots eaten along the input path.
Rules

You can write a full program or a function.
You can take input in either uppercase or lowercase, as either a string or an array of characters. You may also use other characters (but only one character per direction) or integers in [0 .. 9]. If you do so, please specify it clearly in your answer.
You can assume that the input is always valid. (The jsFiddle below will detect errors, but you're not supposed to.)
This is code-golf, so the shortest code in bytes wins.
Standard loopholes are forbidden.

Hint
It may not be required nor optimal to store the exact shape of the maze.
Test cases and demo
The following test cases -- or any other input -- can be tested in this jsFiddle.
1. Input  : &quot;&quot;
   Output : 1
   Comment: Pac-Man just advances to the first junction, eats the Pac-Dot on it and stops.

2. Input  : &quot;L&quot;
   Output : 7
   
3. Input  : &quot;FFR&quot;
   Output : 13
   
4. Input  : &quot;LFLR&quot;
   Output : 17
   Comment: Pac-Man will exit on the middle right side and re-appear on the left side.
   
5. Input  : &quot;BBBB&quot;
   Output : 2
   
6. Input  : &quot;BRRFFFL&quot;
   Output : 15
   
7. Input  : &quot;LFFRLFFFFRF&quot;
   Output : 50
   
8. Input  : &quot;BRFRLRFRLFR&quot;
   Output : 54
   Comment: Pac-Man will exit on the middle left side and re-appear on the right side.
   
9. Input  : &quot;FFLRLFFLLLLFFBFLFLRRRLRRFRFLRLFFFLFLLLLFRRFBRLLLFBLFFLBFRLLR&quot;
   Output : 244
   Comment: All cleared!
Pyth, 356 345 + 1 = 346 bytes

The code contains some unprintables, so here is the reversible xxd hexdump.

0000000: 4a4b 304c 2c3d 2b4b 4062 4a58 624a 3041  JK0L,=+K@bJXbJ0A
0000010: 2c63 6a43 2201 e120 49b4 efbc e267 27f4  ,cjC".. I....g'.
0000020: a11b f5d5 7f79 d1a0 ab8a 7689 449f 0c50  .....y....v.D..P
0000030: b2d4 7c30 99c3 368e aa67 4213 ab9b d276  ..|0..6..gB....v
0000040: d75f 6e99 5757 04a6 08cc 99d0 7141 3d2f  ._n.WW......qA=/
0000050: d854 7cf7 4a70 954e 6e35 f9b9 e0c5 1d53  .T|.Jp.Nn5.....S
0000060: 36d5 63f9 cf13 0f66 c113 4dec 956e 5225  6.c....f..M..nR%
0000070: b14a 1659 dcb5 6822 3534 2034 6a43 2203  .J.Y..h"54 4jC".
0000080: ffe3 8fff 2232 3d59 636a 4322 0b8a 4624  ...."2=YcjC"..F$
0000090: 7815 4a94 192c 79f6 d6e5 e098 5e97 76bc  x.J..,y.....^.v.
00000a0: 23cf 027c 35c5 5098 2a83 68f1 823a 83f6  #..|5.P.*.h..:..
00000b0: dfa4 7e12 443f 0257 7adb ab2d 8e6f 1199  ..~.D?.Wz..-.o..
00000c0: 9a3e 3f9d a524 d331 c5ff 94ae e5a2 3507  .&gt;?..$.1......5.
00000d0: bd22 3334 2032 3d6b 2b30 6a43 2202 25f2  ."34 2=k+0jC".%.
00000e0: f55c 2252 c250 0002 c250 0000 065c 225c  .\"R.P...P...\"\
00000f0: 2247 5289 3698 4227 5350 8822 3136 3d64  "GR.6.B'SP."16=d
0000100: 636a 4322 8223 a80e 5c22 981d d272 729d  cjC".#..\"...rr.
0000110: d88d 981d 5c22 5c22 2bd7 91dd 9428 73d7  ....\"\"+....(s.
0000120: 1dd7 2234 2032 5651 2079 483d 547e 4a40  .."4 2VQ yH=T~J@
0000130: 4047 4a2b 5a78 2246 5242 4c22 4e20 796b  @GJ+Zx"FRBL"N yk
0000140: 3d5a 4040 647e 4a40 4059 4a3d 5421 7840  =Z@@d~J@@YJ=T!x@
0000150: 594a 5454 2968 7948 0a                   YJTT)hyH.




Requires the -M flag to disable memoization. Unfortunately, this can't be done in any online executor I know of.

Here is a readable printable ASCII version:

JK0L,=+K@bJXbJ0A,cj746957013238413906925468440008893181365431681519974815772691846219267045007717553452313017550830370829477591340658010575885616582299429376501117428763541235628345630376341520044712982918668584832091126800263024965443560007480163218792 54 4j17178005503 2=Ycj664551201217474826979459068682259492333017695780569003557724234375880492114440213266014621594427584622393511454741615093293082181365458295035985321888753898774398909 34 2=k+0j883734055588186287049718559289059922762611092840989558085734536 16=dcj53536195844172273707047543644202986760006840011986146398708374999 4 2VQ yH=T~J@@GJ+Zx"FRBL"N yk=Z@@d~J@@YJ=T!x@YJTT)hyH


Explanation

This is very much work in progress, so I won't post a complete explanation yet.

Basically, the program represents the board as a (somewhat weird) graph using five lookup tables: 2 for connectivity, 1 for junction directions, and 2 for dot counts. This was built by a 200-line Python script I spent way too many hours on. Then the program just walks through the input and counts the dots, updating the dot tables to zero as the dots are collected.

TODO:


Write Python routine for reordering the nodes until the lookup table contains as few escape-requiring characters as possible
Try to remove section handling altogether (should remove one lookup table)


UPDATE: tried this, seems to not remove the table and lengthen code

Rewrite Pyth-side logic (the current one isn't very golfed)


UPDATE: somewhat done, code's still imperfect