# Knights on a Torus

An 8×8 chessboard is in the shape of a torus. (This means that the board "wraps around" - you can go left from a2 and come out on h2, for instance. It also works vertically - you can go up from f8 and come out on f1.) What is the minimum number of knights you can place on the board so every square is attacked, even ones with pieces on them?

• Welcome to Puzzling! This is a great question - I've fixed up the grammar and phrasing a bit for you. Let me know if I've accidentally changed what you meant. c: – Deusovi Jul 17 '16 at 12:28
• It's great to see new-comers writing such good question, welcome to puzzling.SE ^_^ – ABcDexter Jul 17 '16 at 12:38
• Wonderful question... One of the best puzzles I have seen coming from a newcomer – Sid Jul 17 '16 at 13:54
• I found this image from this answer in TeX.SE – sampathsris Jul 18 '16 at 4:24

I can do it in 8:

And of course, this is the optimum, since each knight attacks 8 squares and we need to cover at least 64.

• Kudos, by the way found a general solution that every NxN chess-board in form of a Torus can be dominated with N Knights... was proving my hypothesis O:) – ABcDexter Jul 17 '16 at 13:02
• @ABcDexter: Can you show a proof? That's really interesting. – Deusovi Jul 17 '16 at 13:03
• Ok, but you have to wait as my buggy program is showing it for N upto 8, i seriously need to check it for higher values of N. (can't follow hypothesis solely based on a code and intuition) – ABcDexter Jul 17 '16 at 13:09
• And I think i am wrong, which would make me sad :/ but again, Truth(and Logic) alone triumphs... – ABcDexter Jul 17 '16 at 13:11
• You need at least ceil(N²/8) knights for an NxN board, which is bigger than N if N > 8. The way this arrangement happens to cover every square is very fascinating, I must add. – ffao Jul 17 '16 at 15:51

I was looking for a possible duplicate of this problem, then I found

but it doesn't imply that your question is less fascinating.

I'd answer by saying that the worst best case should be:

14
Also, I'm currently writing a program for the best case scenario, hope will do t without bugs :)

p.s.

I've always been intrigued by Torus, especially because of K-map :D

## The original problem

Although there is an existing solution, it's a bit chaotic-looking to my eye, and lacks explanation of how it was created. I'd like to show a more regular solution, observe that in some sense there are no choices to be made when solving this puzzle, and also consider boards of other sizes.

First, since

a knight on a white square can only attack black squares, and vice-versa, we can simplify the problem by only attacking the 32 black squares, as the solution for the black squares can just be duplicated for the white squares.

Thus, we're trying to cover these gray squares:

Initially, all squares are equivalent due to translational symmetry on a torus, so there is effectively no choice about where to place the first knight. I will place it in the center and color the squares it covers green:

From here, if we are going to achieve a perfect cover with no doubly-attacked squares, then whatever knight attacks the square to the right of G must not attack any green square. By rotational symmetry, we again have effectively only once place to put the next knight, here colored pink:

By similar reasoning, one knight must cover the remaining two squares adjacent to G, here colored red:

At this point we have 8 uncovered squares and there is exactly one square that attacks them all, here colored yellow:

The knights on G, P, R, and Y perfectly cover all 32 black squares. Up to rotational and translational symmetry, this is the only such arrangement, as every piece's placement was forced.

For completeness, here is a placement of all 8 knights that is regular and symmetric:

The existing solution is of course equivalent modulo translations of the black and white squares separately. (And of course we could also rotate either or both to reverse the "slope" of each line.)

## Generalizing to NxN

A comment speculated about generalization to NxN. Let's apply the same reasoning as above to the 10x10 case. If we are to achieve a perfect cover, then we again have no choice about the first three knights, here labeled G, P, and R:

If we now focus on covering the squares next to P (which is symmetric with R at this stage), the next placement (labeled Y) is also forced:

This arrangement is a somewhat difficult to process visually because the uncovered squares are mostly near the edges. Let's translate the entire board by 5 squares in each direction:

From this we can see there is only one more place to put a knight (labeled B) that will not doubly-attack anything:

This final arrangement makes it clear that a perfect cover of 10x10 is impossible. We had no meaningful choices up to this point, and are now stuck.

Generalizing, any perfect cover consists of diagonal stripes of knights. The width of that stripe is 4 black squares (or 8 squares total). Consequently, a perfect cover of an NxN torus is possible if and only if N is divisible by 8.

• +1 for great visual solution. – Earlien Jul 30 '20 at 2:11