Revision 62d3c63f-fe13-4d3b-8b86-faae81089ee2 - Code Golf Stack Exchange
# [Ruby], 108 bytes
<!-- language-all: lang-ruby -->
->i{x,y,z=1,2,3
i.map{|j|j-=j/4*7;k=s="";z*z==j*j&&(y,z,s=z,-y,?R);(x,y=y,-x;k+=?F)while x!=j;s+=k[2]??B:k}}
[Try it online!][TIO-m94o0ilv]
[Ruby]: https://www.ruby-lang.org/
[TIO-m94o0ilv]: https://tio.run/##TY7LCsIwEEX3/YraRantRElfgmEMuPAD3JYuFCw2USgWsenj2@NUEN3NPedemMfzbGyFlu3qoQMDPXKIIXHq1f3UDKMaFUO1TsON0Nii54k@7BFVqHw/oDa02AMzII9LEdAeDbBO6AjlYfm61reL2y1QiTZCXcSllPutnibbuFVRxJBBAllZOp@YA4f8G4hDSn/wn51B8o/oJMAJc5I0npV9Aw "Ruby – Try It Online"
A function taking an array of face numbers and returning an array of strings. Will also handle repeat numbers in the input - If the current face is in the input, an empty string is returned.
The dice is represented by the vector `x,y,z` which initially contains `1,2,3` containing the top, front and right sides. If the desired face is to the left or right, we rotate about the x axis `y,z=z,-y` (always to the right.) Then we rotate forward about the z axis `x,y=y,-x` until the desired face is on top. If the number of rotations is more than 2 we output `B` otherwise we output the relevant number of `F`s.
Faces `j `other than `1,2,3` are represented by `j-7` and are therefore `-3,-2,-1` for 4,5,6. A vector with `x=-1` means that the 1 face is on the bottom so the 6 face represented by `-1` is on top.
There are some similarities between l4m2 's code and mine but I'm not sure if they are using the same approach.
**commented code**
->i{x,y,z=1,2,3 #set up vector x,y,z with start position
i.map{|j| #iterate j through elements in input array i
j-=j/4*7 #if j=4,5,6 subtract 7 to convert to -3,-2,-1
k=s="" #setup 2 empty strings: s for right turns, k for forward
z*z==j*j&&(y,z,s=z,-y,?R) #if desired face is right or left (magnitude of j and z is equal) rotate right and s="R"
(x,y=y,-x;k+=?F)while x!=j #rotate forward until desired face on top. Add "F" to k each time
s+=k[2]??B:k} #final value is s (either "R" or "") with k appended. If k has more than 2 F's append "B" instead.
} #return with the value returned by .map (the final values of each iteration.)