Skip to main content
3 of 3
added 500 characters in body
qwr
  • 12.3k
  • 6
  • 48
  • 80

Python 3.10, 82 bytes

lambda b,s:C[C.find(s[:-1])-1]+str(abs(9*b-int(s[-1])))
C="dQeKaQRbQNcQBfKBgKNhKR"

Attempt This Online!

Testing out dictionary interleaving idea which is a little shorter than converting to ascii codes with chr. "Q" and "K" have to come first, otherwise they will match for at "QR".

-4 bytes using find instead of index and a better rank calculation for white/black.

qwr
  • 12.3k
  • 6
  • 48
  • 80