Skip to main content
added 143 characters in body
Source Link
Leo
  • 12.9k
  • 1
  • 33
  • 63

Retina, 3636 30 bytes

6 bytes saved thanks to Neil

 qbnbnrrr /.*bb.(..)*b.*/+V?` Y`rr`rk1`r k 

Try it online!Try it online!

Explanation

 qbnbnrrr Start with this string 

Start with the list of pieces except we have three rooks and no king

/.*bb.(..)*b.*/+V?` Keep shuffling it as long as it matches the regex (odd number of pieces between bishops) Y`rr`rk Replace the second r with a 

Keep shuffling the list as long as it matches the regex b.(..)*b (odd number of pieces between bishops)

1`r k 

Replace the second rook with a king

Retina, 36 bytes

 qbnbnrrr /.*b.(..)*b.*/+V?` Y`rr`rk 

Try it online!

Explanation

 qbnbnrrr Start with this string /.*b.(..)*b.*/+V?` Keep shuffling it as long as it matches the regex (odd number of pieces between bishops) Y`rr`rk Replace the second r with a k 

Retina, 36 30 bytes

6 bytes saved thanks to Neil

 qbnbnrrr /b.(..)*b/+V?` 1`r k 

Try it online!

Explanation

 qbnbnrrr 

Start with the list of pieces except we have three rooks and no king

/b.(..)*b/+V?` 

Keep shuffling the list as long as it matches the regex b.(..)*b (odd number of pieces between bishops)

1`r k 

Replace the second rook with a king

Source Link
Leo
  • 12.9k
  • 1
  • 33
  • 63

Retina, 36 bytes

 qbnbnrrr /.*b.(..)*b.*/+V?` Y`rr`rk 

Try it online!

Explanation

 qbnbnrrr Start with this string /.*b.(..)*b.*/+V?` Keep shuffling it as long as it matches the regex (odd number of pieces between bishops) Y`rr`rk Replace the second r with a k