# Chess pieces attacking exactly N chess pieces

In the spirit of completion and the style of:

Let's see if we can come up with all the other combinations. What is the maximum number of any given chess piece that can fit on an 8x8 board where each piece attacks exactly N enemy pieces?

• For Pawns, we have just N=1 (Pretty sure N=2 is impossible due to one always having to be on the end. We can ignore En Passant rules since how would you define that anyway given that it depends on the previous move?)
• For Bishops and Rooks, we have N=1 and N=2 (I think 3 or 4 would be impossible because someone has to be on the end.)
• Knights are tricky, theoretically could go up to N=8, but I doubt it's possible to go above N=4.
• Queens and Kings are theoretically only possible up to N=4 (again given somebody has to be on the outside.)

So, per the above links N=1 is already done for all pieces, N=3 is done for knights, and N=4 is done for queens. Let's see if we can't fill in those gaps. (We may try for both friendly-fire solutions where piece color is irrelevant, and solutions where pieces only attack the opposing color.)

• I tried knights with N=4 and only got 8 pieces of each color. Knights with N=2 is 22+ pieces each - I will search this one more carefully. – Dmitry Kamenetsky Mar 11 at 4:00
• Isn't this what "tags" are for? (To group questions) – musefan Mar 11 at 10:02
• Rooks: for N=1 and N=2 you can completely fill the board with a simple pattern. – daw Mar 11 at 10:10
• By the way, on a toroidal chessboard (when 1st and 8th ranks are considered adjacent, as well as a- and h-files) it's pretty easy to fill whole board (32+32) with queens/kings for N=6 and bishops for N=4 (placing white on 1st, 3rd, 5th and 7th ranks, and black on 2nd, 4th, 6th and 8th), as well as knights for N=8 and rooks for N=4 (placing white pieces on white squares and black on black). – trolley813 Mar 11 at 13:57
• @DmitryKamenetsky Well, for single color, I've got at N=0: 32 Pawns/Knights, 16 Kings, 14 Bishops, and 8 Rooks/Queens. N=1, 32 Knights, 26 Kings, 20 Bishops, 10 Rooks/Queens, N=2: 33 Kings, 24 Bishops, 16 Knights/Rooks, 9 Queens. N=3: 36 Kings, 16 Queens (actually don't have Knights yet). And that's as far as I got. Do those numbers look right? (I'll probably enter these on the weekend.) – Darrel Hoffman Mar 13 at 4:18

I used a computer program to find solutions for Knights and for Kings.

I am assuming that there have to be an equal number of pieces of each colour.

## KNIGHTS:

For N=0,

you can place 24 knights of each colour:

 B B B B B B B B
B B B B B B B B
B B B B B B B B
. . . . . . . .
. . . . . . . .
W W W W W W W W
W W W W W W W W
W W W W W W W W

For N=1, see this answer to one of the other questions, which uses 24 of each colour.

For N=2:

The largest number of knights is 26 of each colour. There are essentially two solutions, up to rotation, reflection, and colour swapping.

 B B W B B W W .
B W W W B B W B
W W . . W B B W
B W . . . . W B
B B W . . B B W
W B B . B W W W
W W B W B W B B
. B W B W W B .

. B W B B W W .
B W W W B B W B
W W . . W B B W
B W . B . . W B
B B W . . B B W
W B B . B W W W
W W B W B W B B
. B W B W W B .

The N=3 case was tackled in another question.

For N=4:

The best solution uses 8 of each colour. The arrangement actually fits on a $$7\times7$$ board.

 . . . B . . . .
. W . . . W . .
. . W B W . . .
B . B . B . B .
. . W B W . . .
. W . . . W . .
. . . B . . . .
. . . . . . . .

N=5 or larger is not possible. Any knight on the top row of the arrangement has only has 4 directions from which to be attacked.

## KINGS:

For N=0:

You can place 27 kings of each colour. There is room for one extra king of either colour in the centre.

 B B B B B B B B
B B B B B B B B
B B B B B B B B
B B B . . . . .
. . . . . W W W
W W W W W W W W
W W W W W W W W
W W W W W W W W

For N=1, this answer given to one of the other questions uses 16 of each colour, but it turns out that this is not optimal. Rob Pratt found an optimal solution, which uses 17 of each colour.

For N=2:

24 of each colour:

 B W W B B W W B
B W W B B W W B
. . . . . . . .
B W W B B W W B
B W W B B W W B
. . . . . . . .
B W W B B W W B
B W W B B W W B

For N=3:

22 of each colour:

 . B W B W B W .
W W . B W . B B
B B . . . . W W
W . B W B W . B
B W . W B . B W
W B W . . B W B
. B B W B W W .
. . W B W B . .

N=4 or larger is not possible.

• I confirmed these values via integer linear programming. – RobPratt Mar 11 at 18:14
• Why is it not possible for N>=5 ? – Dmitry Kamenetsky Mar 12 at 0:35
• @Dmitry A knight at the edge of the board threatens less than five squares. For any group of knights, some will be on the edge of the minimal bounding box and will threaten no more than four others within the group. – Daniel Mathias Mar 12 at 2:03
• Actually, your answer for N=0 Kings made me think - if we don't require an equal number of pieces on both sides, you can do even better. One King in the corner, 3 spaces around him clear, and the rest of the board filled with 60 Kings of the opposing color, for a total of 61. Though by that strategy, you could trivially fill the board with all 64 (of any piece) of the same color, so maybe it's best to leave that rule in place. – Darrel Hoffman Mar 12 at 16:43
• I confirmed the results for kings, except that $N=1$ yields a maximum of 17 (not 16) kings. – RobPratt Mar 12 at 16:49

For kings, $$N=1$$ yields a maximum of

17:

 . 2 . . 1 . . 2
1 . 2 2 . 1 1 .
. 1 . 2 2 . 1 .
. 1 1 . 2 2 . 1
2 . 1 1 . 2 . 2
. 2 . 1 1 . 2 .
. . 2 . 1 1 . 2
1 2 . 2 . . . 1 

• Nice, although my brain wants to move 3 of those pieces for the sake of symmetry - the B1 could move up to B2, and the H1 and H4 could both move to the G file without changing the results... – Darrel Hoffman Mar 12 at 17:23

This post is a collection of all the answers.

# Single Color

N = 0

- Queens Credit: Wikpedia: Eight Queens Puzzle
The rest I came up with myself.

 32 . . . . . . . .  14 . B B B B B B .  32 N . N . N . N .
P P P P P P P P     . . . . . . . .     . N . N . N . N
. . . . . . . .     . . . . . . . .     N . N . N . N .
P P P P P P P P     . . . . . . . .     . N . N . N . N
. . . . . . . .     . . . . . . . .     N . N . N . N .
P P P P P P P P     . . . . . . . .     . N . N . N . N
. . . . . . . .     . . . . . . . .     N . N . N . N .
P P P P P P P P     B B B B B B B B     . N . N . N . N

8 R . . . . . . .   8 . . . . Q . . .  16 . . . . . . . .
. R . . . . . .     . . Q . . . . .     K . K . K . K .
. . R . . . . .     Q . . . . . . .     . . . . . . . .
. . . R . . . .     . . . . . . Q .     K . K . K . K .
. . . . R . . .     . Q . . . . . .     . . . . . . . .
. . . . . R . .     . . . . . . . Q     K . K . K . K .
. . . . . . R .     . . . . . Q . .     . . . . . . . .
. . . . . . . R     . . . Q . . . .     K . K . K . K .

N = 1

Single color Pawns at N > 0 is undefined, since what direction is forward?

- Bishops and Knights Credit: Hexomino on "Chess pieces attacking exactly once"
- Rooks and Kings Credit: JMP on same question
- Queens Credit: eyl327 on "Queens attacking exactly one queen"

 20 B B B B B B B B  32 N N N N . . N N
. . . . . . . .     N N N N . . N N
. . . . . . . .     . . . . . . N N
. . . . . . . .     . . . . . . N N
B . . . . . . B     N N . . . . . .
B . . B B . . B     N N . . . . . .
B . . B B . . B     N N . . N N N N
B . . . . . . B     N N . . N N N N

10 R R . . . . . .  10 Q . . . . . . .  26 K K . K K . K K
. . R . . . . .     . . . . Q Q . .     . . . . . . . .
. . R . . . . .     . Q . . . . . .     K K . K K . K K
. . . R R . . .     . Q . . . . . .     . . . . . . . .
. . . . . R . .     . . . . . . Q .     K K . K K . K K
. . . . . R . .     . . . . . . Q .     . . . . . . . .
. . . . . . R R     . . Q Q . . . .     K . K . . K . K
. . . . . . . .     . . . . . . . Q     K . K . . K . K

N = 2

I thought I had a 33 King solution for N=2, but it had one King attacking 3.
- Knights and Queens Credit: Daniel Mathias on this question.
- Bishops Credit: Added 2 thanks to Daniel Mathias in the comments.

 26 . B B B B B B .  32 N N N . . N N N
B B . . . . B B     N . N . . N . N
B . . . . . . B     N N N . . N N N
B . . . . . . B     . . . . . . . .
B . . . . . . B     . . . . . . . .
B . . . . . . B     N N N . . N N N
B . . . . . . B     N . N . . N . N
. B B B B B B .     N N N . . N N N

16 . . . R R . . .  12 . Q . Q . . Q .  32 . K K K K K K .
. . R . . R . .     . . . . . . . .     K . . . . . . K
. R . . . . R .     Q . . . . . . Q     K . . K K . . K
R . . . . . . R     . . . . . . . Q     K . K . . K . K
R . . . . . . R     Q . . . . . . .     K . K . . K . K
. R . . . . R .     Q . . . . . . Q     K . . K K . . K
. . R . . R . .     . . . . . . . .     K . . . . . . K
. . . R R . . .     . Q . . Q . Q .     . K K K K K K .

N = 3

- Knights Credit: Daniel Mathias and Rob Pratt on this question.

 32 . . N N N N . .  16 Q Q Q Q Q Q Q Q  36 K K . K K . K K
. N . N N . N .     Q . . . . . . .     K K . K K . K K
. N N N N N N .     Q . . . . . . .     . . . . . . . .
N . . . . . . N     Q . . . . . . .     K K . K K . K K
N . . . . . . N     Q . . . . . . .     K K . K K . K K
. N N N N N N .     Q . . . . . . .     . . . . . . . .
. N . N N . N .     Q . . . . . . .     K K . K K . K K
. . N N N N . .     Q . . . . . . Q     K K . K K . K K

N = 4

Kings TBD
- Queens Credit: Daniel Mathias on this question.
- Knights Credit: Daniel Mathias and Jaap Scherphuis on this question.

 16 . . . N . . . .  20 . Q . . . . Q .
. N . . . N . .     Q . . . . . . Q
. . N N N . . .     Q . . . . . . Q
N . N . N . N .     Q . . . . . . Q
. . N N N . . .     Q . . . . . . Q
. N . . . N . .     Q . . . . . . Q
. . . N . . . .     Q . . . . . . Q
. . . . . . . .     . Q Q Q Q Q Q .

# Two Colors

Pawns, N = 0

Assuming white is on the bottom, you can just fill the board with 32 of each:

 W W W W W W W W
W W W W W W W W
W W W W W W W W
W W W W W W W W
B B B B B B B B
B B B B B B B B
B B B B B B B B
B B B B B B B B

Though if you don't want to allow that because it puts pawns in the back row where they should be promoted, you can get away with 28:

 B B B B B B B B
B B B B B B B B
B B B B B B B B
B . B . B . B .
W . W . W . W .
W W W W W W W W
W W W W W W W W
W W W W W W W W

Pawns, N = 1

- Credit: Hexomino on "Chess pieces attacking exactly once"

 . B B . . B B .
W B B W W B B W
W B B W W B B W
W B B W W B B W
W B B W W B B W
W B B W W B B W
W B B W W B B W
W . . W W . . W

Pawns > 1 is impossible without a cylindrical board.

Bishops, N = 0

Trivially, we just place 32 of each color on its own color squares:

 W B W B W B W B
B W B W B W B W
W B W B W B W B
B W B W B W B W
W B W B W B W B
B W B W B W B W
W B W B W B W B
B W B W B W B W

Bishops, N = 1

26 of each can fit.
- Credit: Steve on "Chess pieces attacking exactly once" (rotation of Daniel Matthias' answer on this question.)

 . B B . . W W .
W B B W B W W B
B W W B W B B W
. W W W B B B .
. W W W B B B .
B W W B W B B W
W B B W B W W B
. B B . . W W .

Bishops, N = 2

22 of each can fit.
- Credit: Daniel Matthias on this question.

 . . . W W . . .
. W B B B B W .
B W B . . B W B
B W . B B . W B
. W W W W W W .
. W W B B W W .
B B B B B B B B
. W W . . W W .

Bishops > 2 is impossible.

Knights, N = 0

24 of each can fit.
- Credit: Jaap Scherphuis on this question.

 B B B B B B B B
B B B B B B B B
B B B B B B B B
. . . . . . . .
. . . . . . . .
W W W W W W W W
W W W W W W W W
W W W W W W W W 

Knights, N = 1

24 of each can fit.
- Credit: Steve on "Chess pieces attacking exactly once"

 W B B W B W W B
B W W B W B B W
W B . . . . W B
B W . . . . B W
B W . . . . B W
W B . . . . W B
B W W B W B B W
W B B W B W W B 

Knights, N = 2

26 of each can fit:
- Credit: Jaap Scherphuis on this question.

 B B W B B W W .
B W W W B B W B
W W . . W B B W
B W . . . . W B
B B W . . B B W
W B B . B W W W
W W B W B W B B
. B W B W W B .

Knights, N = 3

18 of each can fit.
- Credit: Rob Pratt on "Knights attacking exactly three knights"

 . . W B W B . .
. W . W B . B .
. B W B W B W .
B . . . . . . W
W . . . . . . B
. W B W B W B .
. B . B W . W .
. . B W B W . .

Knights, N = 4

8 of each can fit:
- Credit: Jaap Scherphuis on this question.

 . . . B . . . .
. W . . . W . .
. . W B W . . .
B . B . B . B .
. . W B W . . .
. W . . . W . .
. . . B . . . .
. . . . . . . . 

Rooks, N = 0

This can be done with 16 of each color like so:

 . . . . B B B B
. . . . B B B B
. . . . B B B B
. . . . B B B B
W W W W . . . .
W W W W . . . .
W W W W . . . .
W W W W . . . .

Rooks, N = 1

32 of each color can fill the board like so:

 B W W B B W W B
B W W B B W W B
B W W B B W W B
B W W B B W W B
B W W B B W W B
B W W B B W W B
B W W B B W W B
B W W B B W W B

Rooks, N = 2

Can also be done with 32 of each color:

 B W W B B W W B
W B B W W B B W
W B B W W B B W
B W W B B W W B
B W W B B W W B
W B B W W B B W
W B B W W B B W
B W W B B W W B 

Rooks > 2 is impossible.

Queens, N = 0

9 of each can fit.
- Credit: Daniel Mathias on Discrete Peaceful Encampments: 9 queens on a chessboard

 . . . B B B . B
W W . . . . . .
. . . B . B . B
. . . . B . . B
. . W . . . . .
. W . . . . . .
W . W . . . W .
. W . . . . W .

Queens, N = 1

16 of each can fit.
- Credit: Daniel Matthias on "Chess pieces attacking exactly once"

 W B . B W . W B
. . B . . W . .
W B . B W . W B
. . B . . W . .
W B . B W . W B
. . B . . W . .
W B . B W . W B
. . B . . W . . 

Queens, N = 2

20 of each can fit.
- Credit: Daniel Matthias on this question.

 B W . W B . B W
W B . B W . W B
. . B . . W . .
W B . B W . W B
B W . W B . B W
. . W . . B . .
B W . W B . B W
W B . B W . W B 

Queens, N = 3

20 of each can fit.
- Credit: Daniel Matthias on this question.

 W B W . . W B W
B B . B B . B B
W . . W W . . W
. B W . . W B .
. B W . . W B .
W . . W W . . W
B B . B B . B B
W B W . . W B W

Queens, N = 4

14 of each can fit.
- Credit: daw on "Queens attacking exactly four queens"

 . B . W B . W .
W . . . . . . B
. . . W B . . .
B . B W B W . W
W . W B W B . B
. . . B W . . .
B . . . . . . W
. W . B W . B .

Kings, N = 0

27 of each can fit.
- Credit: Jaap Scherphuis on this question.

 B B B B B B B B
B B B B B B B B
B B B B B B B B
B B B . . . . .
. . . . . W W W
W W W W W W W W
W W W W W W W W
W W W W W W W W

Kings, N = 1

17 of each can fit.
- Credit: Rob Pratt on this question.

 . W . . B . . W
B . W W . B B .
. B . W W . B .
. B B . W W . B
W . B B . W W ,
. W . B B . W .
. W W . B B . W
B . . W . . B .

Kings, N = 2

24 of each can fit.
- Credit: Jaap Scherphuis on this question.

 B W W B B W W B
B W W B B W W B
. . . . . . . .
B W W B B W W B
B W W B B W W B
. . . . . . . .
B W W B B W W B
B W W B B W W B

Kings, N = 3

22 of each can fit.
- Credit: Jaap Scherphuis on this question.

 . B W B W B W .
W W . B W . B B
B B . . . . W W
W . B W B W . B
B W . W B . B W
W B W . . B W B
. B B W B W W .
. . W B W B . .

Kings > 3 is impossible.

• @DanielMathias Yes, that was from before you posted an answer and just had that comment. I'm going to update this post some more this weekend to include all of them. – Darrel Hoffman Mar 13 at 20:03
• It's so pretty! – Dmitry Kamenetsky Mar 14 at 12:05
• @DanielMathias Alright, I think I got everything. That was a lot of work compiling answers from 6 different questions all into one place (along with a bunch I came up with myself), so if I missed anything else, please let me know or add it yourself, I made this post a CW specifically for that reason. – Darrel Hoffman Mar 14 at 15:27
• Looks good. If I find any other improvements, I'll likely edit this myself. – Daniel Mathias Mar 14 at 15:43
• Looks great! Thank you for doing this. – Dmitry Kamenetsky Mar 17 at 11:27

Bishops, N=0

Trivially, 32 of each color

 B W B W B W B W
W B W B W B W B
B W B W B W B W
W B W B W B W B
B W B W B W B W
W B W B W B W B
B W B W B W B W
W B W B W B W B

Bishops, N=1

26 of each color, showing dark and light squares separately and combined.

 - B - - - W - -      - - W - - - B -      - B W - - W B -
W - B - B - W -      - W - B - B - W      W W B B B B W W
- W - B - B - W      W - B - B - W -      W W B B B B W W
- - W - B - B -      - B - B - W - -      - B W B B W B -
- W - W - B - -      - - B - W - W -      - W B W W B W -
B - W - W - B -      - B - W - W - B      B B W W W W B B
- B - W - W - B      B - W - W - B -      B B W W W W B B
- - B - - - W -      - W - - - B - -      - W B - - B W -

Bishops, N=2

22 of each color, showing dark and light squares separately and combined.

 - - - W - - - -      - - - - W - - -      - - - W W - - -
- - B - B - W -      - W - B - B - -      - W B B B B W -
- W - - - B - B      B - B - - - W -      B W B - - B W B
B - - - B - W -      - W - B - - - B      B W - B B - W B
- W - W - W - -      - - W - W - W -      - W W W W W W -
- - W - B - W -      - W - B - W - -      - W W B B W W -
- B - B - B - B      B - B - B - B -      B B B B B B B B
- - W - - - W -      - W - - - W - -      - W W - - W W -

Queens, N=2

22 of each color (no diagonal attacks)

 B W - W B - B W
W B - B W - W B
- - B - - W - -
W B - B W - W B
B W - W B - B W
- - W - - B - -
B W - W B - B W
W B - B W - W B

Queens, N=3

20 of each color

 W B W - - W B W
B B - B B - B B
W - - W W - - W
- B W - - W B -
- B W - - W B -
W - - W W - - W
B B - B B - B B
W B W - - W B W

Lichess links for new or improved monochrome solutions:

Knights, N=2

Queens, N=2

Queens, N=4

• There is a nice proof by induction that Bishops with N>=3 is not possible. You easily find that you need a bishop on the edge, but it cannot attack more than 2 opponents there. – Dmitry Kamenetsky Mar 13 at 1:08
• Your Queens N=2 solution has only 20, just FYI. I corrected it on the master post. – Darrel Hoffman Mar 14 at 15:37