Task
A reverse checkers position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (valid) position meets these criteria.
For example, this position does (click for larger images). Every white piece is on a light square, while every black piece is on a dark square:
This position is also a reverse checkers position. Every white piece is on a dark square, while every black piece is on a light square:
Input
Your input will be a valid chess position. You choose whether it'll be a FEN (for the purpose of this challenge, we'll only consider the first field, piece placement), or an 8x8 grid (with spaces or not between). If the latter, mention in your answer what characters you used to denote empty squares and the pieces.
The examples below will use upper-case letters for white pieces and lower-case for black. Empty squares are represented by dots (.
).
The first position above:
5r1k/2p3b1/1p1p1r2/p2PpBp1/P1P3Pp/qP1Q1P1P/4R1K1/7R . . . . . r . k . . p . . . b . . p . p . r . . p . . P p B p . P . P . . . P p q P . Q . P . P . . . . R . K . . . . . . . . R
is a reverse checkers position.
The second position above:
r3r3/5pBk/p3nPp1/1p1pP2p/2pPb1p1/P1P1N1P1/1P3R1P/R5K1 r...r... .....pBk p...nPp. .p.pP..p ..pPb.p. P.P.N.P. .P...R.P R.....K.
is a reverse checkers position as well.
The starting position:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR bbbbbbbb bbbbbbbb ........ ........ ........ ........ wwwwwwww wwwwwwww
is not a reverse checkers position.
Rules
- The chess position will always be valid.
- You may use two characters for the pieces, one for white pieces and one for black pieces (i.e. you don't have to use a different character for every piece).
- You can receive input through any of the standard IO methods.
- This is code-golf, so shortest code in bytes wins!
0
,1
,2
? \$\endgroup\$[1]
for "is a reverse checkers position" and[1,1]
for "is not", or does the output have to be a truthy value and a falsey value, or does it have to be0
/1
, etc.? \$\endgroup\$