Python 3, 111 bytes
def f(s):
u,f,r,l,b,d='WGROBY'
for c in s:
if'R'==c:u,f,d,b=b,u,f,d
else:u,l,d,r=l,d,r,u
return'WG'==u+f
There are a few ways I can think to shave off a few bytes, but I'll just leave it like this, since this approach isn't anywhere near competitive anyway. Happy to hear about other tweaks, though!
- -5: Take a boolean array as input, so
if'R'==c:
can be justif c:
- -1: Or just change
if'R'==c:
toif'L'<c:
- -1: Or just change
- -1: Change the lettering scheme from
WGROBY
toABCDEF
so'WG'==u+f
can be'AC'>u+f