Ruby, 108 bytes
->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}}
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 yz 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 Fs.
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 Kk has more than 2 F's append "B" instead.
} #return with the value returned by .map (the final values of each iteration.)
Ruby, 108 bytes
->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}}
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 y 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 Fs.
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
(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.)
Ruby, 108 bytes
->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}}
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 Fs.
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.)
Ruby, 108 bytes
->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}}
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 y 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 Fs.
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
(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.)
Ruby, 108 bytes
->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}}
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 y 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 Fs.
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.
Ruby, 108 bytes
->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}}
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 y 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 Fs.
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
(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.)