Art gallery problem with rook and queen vision

How many chess rooks or queens does it take to guard all the squares of a given polyomino, the union of square tiles from a square grid? This question is a version of the art gallery problem in which the guards can"see"whichever squares the rook or queen attacks. We show that floor(n/2) rooks or floor(n/3) queens are sufficient and sometimes necessary to guard a polyomino with n tiles. We also prove that finding the minimum number of rooks or the minimum number of queens needed to guard a polyomino is NP-hard. These results also apply to d-dimensional rooks and queens on d-dimensional polycubes. We also use bipartite matching theorems to describe sets of non-attacking rooks on polyominoes.


Introduction
Perhaps the most famous mathematical problem involving chess pieces is the eight-queens problem from the mid-1800s, which asked for all the ways to place eight mutually non-attacking queens on a standard chessboard; generalizations of this problem have been popular research problems ever since that time [BS09]. In particular, a recent NP-hardness result addresses the problem of when an initial placement of queens can be extended [GJN17]. (In Theorem 13 we show that the analogous problem for rooks instead of queens is polynomial-time solvable, even on non-rectangular boards.) In our paper instead of placing chess pieces on rectangular chessboards, we use arbitrary polyominoes as our boards. A polyomino is the union of finitely many squares from the infinite chessboard, that is, from the standard tiling of the plane by unit squares, such that the interior of the polyomino is connected. We refer to the squares as tiles. Similarly, in d dimensions, a d-polycube is the union of finitely many d-cubes (tiles) from the standard tiling of R d by unit d-cubes, such that the interior of the polycube is connected.
In this paper we place chess rooks and queens on the tiles to guard the polyomino or polycube. (One could also consider the same questions for other chess pieces, but rooks and queens share the ability to attack along rows and columns.) Roughly, we say that our rook or queen's line of attack ends when it crosses outside the polycube. More precisely, we imagine the d-cubes centered at the points of Z d . Suppose that we have a rook at (0, . . . , 0). For each point that has all coordinates 0 except for one coordinate ±1, we say that the d-dimensional rook guards or attacks the Date: November 21, 2018. 2010 Mathematics Subject Classification. 03D15, 05B40, 05B50, 00A08. tiles with coordinates given by all natural-number multiples of this point such that all the smaller natural-number multiples are tiles of our d-polycube. Similarly, suppose that we have a queen at (0, . . . , 0). For each point that has all coordinates equal to 0 or ±1, we say that the d-dimensional queen guards or attacks the tiles with coordinates given by all natural-number multiples of this point such that all the smaller natural-number multiples are tiles of our d-polycube.
This paper addresses the problem of finding the minimum number of rooks or queens needed to guard all the tiles of a given polyomino. A set of rooks or queens that guards all the tiles of a polyomino is also called a dominating set. The question is similar to the famous art gallery problem of Chvátal, in which ⌊ n 3 ⌋ guards are sufficient to see all points in an n-vertex polygon, and some polygons need this many guards [Chv75]. The art gallery problem for polyominoes was introduced in [BII + 12], where those authors show that ⌊ n+1 3 ⌋ guards are sufficient and sometimes necessary to see all points in an n-tile polyomino. Different notions of vision are possible in art gallery problems. Classically the guards are points that can see along line segments in all directions; in our setup, the guards use "rook vision" that sees horizontally and vertically from all the points of a given tile, or "queen vision" that also sees diagonally. Our Theorems 1 and 2 show that ⌊ n 2 ⌋ rook guards, or ⌊ n 3 ⌋ queen guards, are sufficient and sometimes necessary to guard an n-tile polyomino with rook vision. For square chessboards, asymptotic results are known on the number of queens needed to dominate [GHVS90].
The computational complexity of finding the minimum number of guards for a given art gallery has been studied for many variations on the original art gallery setup. The original version is NP-hard [LL86], and so is the problem on polyominoes with standard vision, even if the polyomino is required to be bounded by a simple closed curve (i.e., it has no holes, or is simply connected) [BII + 11].
Another notion of vision that is useful for computation on polyominoes is rvisibility , in which one point can see another if and only if the rectangle aligned with the axes with those two points as opposite corners is completely contained within the polyomino. The problem of finding the minimum number of r-visibility guards for a given polyomino is polynomial-time solvable if the polyomino is required not to have holes [WK07]. However, Iwamoto and Kume show that rvisibility guard set problem on polyominoes with holes is NP-hard [IK14]; we adapt their proof to prove Theorems 3 and 4, which say that finding the minimum number of rooks or queens to guard a given polyomino is NP-hard.
Theorem 3, about the NP-hardness of the art gallery problem for rook vision, should be contrasted with a very similar art gallery problem. In the paper [Nta86] of Ntafos (described in the book [O'R87]), a grid consists of a finite union of horizontal and vertical line segments. With the usual notion of vision, any guards must then see horizontally and vertically as rooks do, but the problem of finding the minimum number of guards is polynomial-time solvable [Nta86]. This is because the two problems are slightly different. For example, a 2 by 3 rectangle polyomino can be guarded by two rooks, but the corresponding grid of 2 horizontal and 3 vertical segments requires three guards, because every point on every segment must be guarded. The grid art gallery problem in dimension at least 3, though, is NPhard [Nta86].
1.1. Our results. Our first pair of results are analogous to the result in [BII + 12] that gives the minimum number of guards needed to see all of an n-tile polyomino.
The difference is that our guards are rooks or queens rather than points with standard vision.
Theorem 1. In any dimension d, the number of d-dimensional rooks that are sufficient and sometimes necessary to guard a d-polycube with n tiles is min 1, ⌊ n 2 ⌋ . Theorem 2. In any dimension d, the number of d-dimensional queens that are sufficient and sometimes necessary to guard a d-polycube with n tiles is min 1, ⌊ n 3 ⌋ . Our second pair of results are analogous to the result in [IK14] that shows that finding the minimum number of r-visibility guards for a polyomino is NP-hard. Instead of using r-visibility we adapt the proof for rook vision and queen vision. Formally, we say that an instance of the rook-visibility guard set problem for polyominoes is a pair (P, m) where P is a polyomino and m is a positive integer. The problem asks whether there exists a set of m rooks placed in P which guard all tiles of P . A similar definition applies to d-polycubes for any dimension d; proving that the rook-visibility guard set problem for polyominoes is NP-hard immediately implies the result for d-polycubes for any d, because we can restrict to those polycubes that stay in a single 2-dimensional layer. Likewise, we can define the queen-visibility guard set problem for polyominoes and for d-polycubes for any d.
Theorem 3. The rook-visibility guard set problem for polyominoes is NP-hard, and thus the rook-visibility guard set problem for d-polycubes is NP-hard for any dimension d.
Theorem 4. The queen-visibility guard set problem for polyominoes is NP-hard, and thus the queen-visibility guard set problem for d-polycubes is NP-hard for any dimension d.
In Section 2 we prove Theorems 1 and 2. In Section 3 we prove Theorems 3 and 4. In Section 4 we prove several more theorems about non-attacking rooks on polyominoes by viewing non-attacking rook sets on polyominoes as matchings in bipartite graphs; this construction is specific to rooks and specific to 2-dimensional polyominoes. The paper concludes with some open questions. under Award No. DMS 1802914, and this project was begun when both authors were in residence at ICERM (Institute for Computational and Experimental Research in Mathematics) in Autumn 2016. We would like to thank László Kozma, who suggested the proof of Theorem 1 that appears in the paper, and Frank Hoffmann, who brought the paper [Nta86] of Ntafos to our attention.

Polyominoes Most Difficult to Guard
In this section we prove Theorems 1 and 2.
Proof of Theorem 1. First we show that every d-polycube with n tiles can be guarded by ⌊ n 2 ⌋ d-dimensional rooks. If the polycube has only one tile, we place one rook on that tile. Otherwise, we 2-color the polycube according to the parity of the sum of coordinates of each tile; that is, tiles that share a (d − 1)-dimensional face get opposite colors. We take the color with the smaller number of tiles, and place rooks on all tiles of that color, so that there are at most ⌊ n 2 ⌋ rooks. Because the interior of the polycube is connected, every tile shares a (d − 1)-dimensional face with some other tile. Thus every tile is guarded by at least one of the rooks.
Next we exhibit, for every natural number n, a polyomino with n tiles such that the minimum number of rooks needed to guard it is ⌊ n 2 ⌋. To get an example in any dimension d, we can just thicken this polyomino to d dimensions. The construction, shown in Figure 1 for n = 10 and n = 11 tiles, consists of one center column with individual tiles attached on either side, alternating between left and right. More precisely, given n = 2m tiles it is possible to form m horizontal dominoes, that we denote by d 1 , d 2 ,..., d m , that we use to construct a polyomino P n by stacking them vertically in the following way: place the first domino d 1 , then place on top of d 1 the second horizontal domino d 2 in such a way that the left tile of d 2 is on top of the right tile of d 1 ; then, place d 3 on top of d 2 in such a way that the right tile of d 3 is on top of the left tile of d 2 ; keep placing the rest of the dominoes in the same way, alternating the right and left placement relationships from one added domino to the next one. This construction generates a polyomino P n for even n = 2m such that each domino has one tile in a common column that we denote by c * . For an odd number n = 2m − 1 we construct a polyomino P n by placing a tile on the bottom-most part of column c * of P n−1 . To prove that n 2 rook guards are needed, we observe that there are exactly n 2 tiles not in the center column, and that no two of these can be guarded by the same rook. Figure 1. On the left, we depict a 10-omino that cannot be guarded with fewer than 5 rooks. On the right, we depict an 11-omino that cannot be guarded with fewer than 5 rooks. Any polyomino with this kind of shape with n tiles cannot be guarded with fewer than n 2 rook guards.
The proof of Theorem 2 relies on labeling the tiles of our d-polycube according to the number of steps needed to get back to a given root tile. We say that two tiles are adjacent or are neighbors if they share a (d − 1)-dimensional face. The ℓ 1 -distance between any two tiles of a d-polycube is the minimum number of steps needed to get from one to the other, such that each step goes from one tile of the polycube to an adjacent tile of the polycube.
Lemma 5. In a d-polycube, any queen must guard every tile of ℓ 1 -distance at most 2 from that queen.
Proof. Suppose our queen is at (0, . . . , 0). It certainly guards every tile of ℓ 1distance 1 from it, because those tiles are adjacent to it. Consider any tile of ℓ 1 -distance 2 from the queen. If it has all coordinates 0 except for two that are ±1, then we know that the queen guards that tile. If it has all coordinates 0 except for one that is ±2, then we just need to check that the one tile between our chosen tile and the queen is inside the polycube. But, if it were not, then our chosen tile could not have ℓ 1 -distance 2 from the queen, because every path that stays within the polycube would have to go around the missing tile. These are the only possibilities for the tiles within ℓ 1 -distance 2 of the queen, and the queen guards all of them.
Because of this lemma, when guarding a d-polycube with queens it suffices to find a placement of the queens such that every tile of the polycube is within ℓ 1distance 2 of a queen.
Proof of Theorem 2. First we show that every d-polycube with n tiles can be guarded by ⌊ n 3 ⌋ queens. We select one tile of the polycube to be the root, and label all the tiles according to their ℓ 1 -distance from the root. If possible, we select as the root a tile that is adjacent to only one other tile. If every tile of the polyomino is adjacent to more than one other tile, then we may select any tile as the root.
The tiles are partitioned into three sets according to whether their ℓ 1 -distance from the root is 0, 1, or 2 mod 3. If the 2 mod 3 set is empty, then a queen placed on the root guards the whole polyomino. Otherwise, we place queens on all the tiles in the smallest of the three sets. We claim that every tile is within ℓ 1 -distance 2 of at least one queen. If the queen set is the 0 mod 3 set, then from an arbitrary tile, we can find a queen within two steps by walking along a shortest path to the root. Similarly, if the queen set is the 1 mod 3 set, then from every tile except the root, we can find a queen within two steps by walking along a shortest path to the root, and we know that the root is also adjacent to a queen.
If the queen set is the 2 mod 3 set, then from every tile of ℓ 1 -distance at least 2 from the root, we can find a queen within two steps toward the root, so it remains to check the root and the tiles adjacent to the root. We know that the root is ℓ 1 -distance exactly 2 from a queen. If it is adjacent to only one tile, then that tile is adjacent to a queen. Otherwise, every tile in the polyomino is adjacent to at least two tiles. Given a tile adjacent to the root, it must also be adjacent to another tile, and that tile is of ℓ 1 -distance 2 from the root and thus has a queen-for parity reasons, no two tiles adjacent to the root are adjacent to each other. Thus in all cases, every tile is within ℓ 1 -distance 2 of a queen, and thus by Lemma 5 it is guarded by a queen.
We exhibit a polyomino with n tiles that needs ⌊ n 3 ⌋ queen guards, and this polyomino may be fattened to any dimension d. The construction is very similar to the construction for rooks and is shown in Figure 2. If n = 3m, we make m rows of 3 tiles each, and stack them so that the center column contains the right-most tile of the first row, the left-most tile of the second, and the right-most tile of the third, and continues to alternate. Then if n = 3m + 1 or n = 3m + 2, we add the remaining one or two tiles to the bottom of the center column. Then no two of the m tiles furthest to the left and right can be guarded by the same queen, so at least m = ⌊ n 3 ⌋ queens are needed to guard this polyomino.

NP-Hardness Proof
In this section we prove Theorems 3 and 4 about the NP-hardness of the rookvisibility and queen-visibility guard set problems, using the NP-hardness of PLA-NAR 3SAT. First we prove the rook version, and then we show how to make the minor modifications needed for the queen version. We reproduce here the definition of PLANAR 3SAT as given by Iwamoto and Kume in [IK14], who attribute the description there to [GJ79]. Let U = {x 1 , x 2 , . . . , x n } be a set of Boolean variables, which take on the values 0 (false) and 1 (true). If x is a variable in U , then x and x are called literals, with the value of x defined to be 1 if x is 0 and vice versa. A clause is any set of literals over U , such as {x 1 , x 3 , x 4 } which represents "x 1 is false or x 3 is true or x 4 is true", and the clause is satisfied by a truth assignment whenever at least one of its literals is true under that assignment.
An instance of PLANAR 3SAT is a collection C of clauses over U , each containing either 2 or 3 literals, such that the following bipartite graph is planar: the vertex set is U ∪ C, and the pair {x, c} is an edge whenever either literal x or x belongs to the clause c. The PLANAR 3SAT problem asks whether there exists some truth assignment for U that simultaneously satisfies all the clauses in C. This problem is known to be NP-hard. It is even known to be NP-hard under the additional hypothesis that every variable x occurs exactly once positively (i.e., as x) and exactly twice negatively (i.e., as x) in C; this problem is called P3SAT 3 , which stands for PLANAR 3SAT WITH EXACTLY 3 OCCURRENCES PER VARIABLE [CFF + 08].
To prove Theorem 3, we give a polynomial reduction that constructs a rookvisibility guard set problem for each instance of P3SAT 3 . Given an instance of P3SAT 3 , we replace each variable by a variable gadget, each clause by a clause gadget, and each edge between variable and clause by a connection gadget.
Each connection gadget is a path one tile wide from a variable gadget to a clause gadget. The variable gadget appears in the left of Figure 3. Recall that each variable appears in one clause positively and in two clauses negatively. At the variable gadget, the connection gadget to the clause with the positive literal extends out to the left from tile A, and the connection gadgets to the two clauses with the negative literals extend out to the right from tiles B and C. The clause gadget is either three vertically-consecutive tiles, if the clause contains two literals, or five vertically-consecutive tiles, if the clause contains three literals. These two options appear in the right of Figure 3. The connection gadgets extend sideways from the first and third tiles, or from the first, third, and fifth tiles. Figure 3. In the polyomino corresponding to an instance of P3SAT 3 , each variable is represented by the variable gadget shown on the left, and each clause is represented by one of the clause gadgets shown on the right, according to whether the clause contains two literals or three.
The proof of Lemma 8 gives more detail on how to construct the polyomino from the three types of gadgets. First, we prove the distinctive properties of the variable gadget that will be needed in the main proof to encode P3SAT 3 .
Lemma 6. There is only one way to guard the variable gadget with four rooks if one of them is at A, and there is only one way to guard the variable gadget with four rooks if two of them are at B and C. Proof. In Figure 4 we depict the variable gadget and we label some of its tiles. Also, we depict the unique configurations stated in this lemma. If a rook is on A, then the remaining three rooks have to guard tiles W , B, and C. Observe that no two of these tiles can be guarded by the same rook because they are in different rows and in different columns. Then three rooks are needed to guard tiles W , B, and C, and this cannot be accomplished if one of these three rooks is in the row containing tiles R, S, and T , because these tiles do not share rows or columns in common with tiles W , B, or C. Also, the rook on A cannot guard tiles R, S, or T . This forces the rooks guarding W , B, and C to also guard tiles R, S, and T . This can only be done if the rooks are placed on tiles X, Y , and Z.
If two rooks are on tiles B and C, then there is a third different rook that has to guard tile A. None of these three rooks are able to guard tiles R, S, or T . Thus a fourth rook has to be placed in this row. Tile W cannot be guarded by the rooks at B and C, or by the rook that guards R, S, and T . Thus, W has to be guarded by the rook guarding A, and this forces that third rook to be placed on U . Also, tile X has to be guarded, and it cannot be guarded by the rooks guarding tiles B, C, or A. This forces the fourth rook to be placed on S.
Corollary 7. Let G be an arbitrary four-rook set guarding all tiles of the variable gadget. If G has a rook on tile B or C, then G has no rook on tile A, and if G has a rook on A then it has no rooks on B or C. Also, there does not exist a three-rook set guarding all tiles of the variable gadget.
Proof. In Lemma 6 we have proved that in any four-rook set guarding the variable gadget, once a rook is placed on A then there cannot be a rook placed on B or C. If there exists a three-rook set guarding all tiles of the variable gadget, then none of the rooks is on A because of the uniqueness proved in Lemma 6. Then we can place a fourth rook on A. This gives us a four-rook set guarding the variable gadget with a rook placed on A; thus this set has to be the one described in Lemma 6, and then if the rook placed at A is removed, then tile A is not guarded. Thus there cannot exist a three-rook set guarding the variable gadget.
In the next lemma, we check that given an instance of P3SAT 3 , the corresponding instance of the rook-visibility guard set problem is not too large.
Lemma 8. Let C be an instance of P3SAT 3 with n variables. We can construct a polyomino P (C) with O(n 2 ) tiles, formed by taking a planar drawing of the instance C and replacing the variable nodes by variable gadgets, the clause nodes by clause gadgets, and the edges by connection gadgets.
Proof. If we did not care about the size of the polyomino, we would simply take any smoothly differentiable planar drawing of C and scale it up so large that when we superimposed it on the grid of unit squares, we could locally replace the vertices by variable and clause gadgets and the edges by grid paths. The question is how to limit the amount of scaling up that we need to do in order to make these local replacements.
We use a procedure described in [BBN + 13] that creates a planar drawing of the graph of C on the grid of unit squares in such a way that every vertex is a unit square, every edge is a path of unit squares between the two vertices of the edge, and the whole drawing fits in an O(n) by O(n) square. For convenience we describe the process again here. Figure 5 depicts the process where the graph is the cube.
A (weak) visibility representation of a planar graph is a way to draw it in the plane such that each vertex is a horizontal segment, each edge is a vertical segment, the endpoints of each edge are on the horizontal segments corresponding to the two incident vertices, and there are no other intersections among the segments. Every planar graph has a visibility representation. A quick proof of this fact, based on the fact that every planar graph can be drawn with straight edges, can be found in [DHLVM83].
Given a visibility representation of our planar graph, we look at the collection of x-coordinates and y-coordinates of the endpoints of all the segments, and assume without loss of generality that the only repeated coordinates are those that are implied by having a visibility representation. We thicken each segment slightly to get a collection of rectangles with the same combinatorial relationship as in our desired end result. Then we make a new set of rectangles with the same combinatorial relationship, by moving all the horizontal coordinates to consecutive integer values while keeping them in the same order, and similarly for the vertical coordinates.
In our instance C of P3SAT 3 , there are n variables, so there are exactly 3n edges and fewer than 6n total nodes. Our drawing has one rectangle for each node and one rectangle for each edge, so there are at most 9n rectangles, with at most 18n horizontal coordinates and at most 18n vertical coordinates. Thus our new drawing fits in an 18n by 18n square.
At this stage, each node of the graph of C is represented by a horizontal strip of squares. But, we know that every node has degree 2 or 3. Thus, for each node, if it has degree 2 we select any square of the strip to be the node square, and think of the remaining squares as edge squares. If it has degree 3 we select the node square to be the square of the strip that touches the middle one of the three incident edges, and think of the remaining squares as parts of the two outer edges. In this way, we have succeeded in drawing the graph of C on the square grid in a square of side length O(n).
The only further modification we need is to accommodate the fact that the variable gadget and the clause gadgets are more than one square large. To do this, we subdivide the drawing we have made-replacing each unit square by a 15 by 15 grid should be enough. This is enough space for the variable gadgets and the clause gadgets to be placed in the middle of the corresponding node squares, and for the connection gadgets to extend outward from them toward the corresponding edge squares so that they can follow the middles of the edge squares, as in Figure 6. The resulting polyomino P (C) has O(n 2 ) tiles.
The next lemma statement involves counting bends of connection gadgets. A bend is a tile where the path of the connection gadget changes between horizontal and vertical. Because each connection gadget is horizontal on both ends where it connects to the variable and clause gadgets, it must have an even number of bends. The next two lemmas show that given an instance of P3SAT 3 , the corresponding instance of the rook-visibility guard set problem is indeed equivalent.
Lemma 9. Let C be an instance of P3SAT 3 as in Lemma 8, and let P (C) be its associated polyomino. Let m = 4n + ℓ 2 , where n is the number of variables and ℓ is the total number of bends in all the connection gadgets. If C is satisfiable, then P (C) can be guarded by m rooks.
Proof. Consider a truth assignment that satisfies all the clauses in C. For each variable, if it is true in this truth assignment, we guard the corresponding variable gadget with the four-rook set from Lemma 6 with a rook on tile A; if it is false in this truth assignment, we use the set with rooks on B and C.
For each edge, we say that the edge joining a variable with a clause is hot if the variable is true and it appears in the clause, or if the variable is false and its negation appears on the clause. So, for each hot edge, we have placed a rook on A, B, or C of the variable gadget; move that rook sideways along the corresponding connection gadget to land on the first bend (or all the way to the clause gadget if there is no bend). Then place rooks at every second bend for the rest of the hot edge, ending with one rook on the clause gadget. For each non-hot edge, we start with a rook at the second bend leading away from the variable gadget (the first bend is already guarded by a rook on the variable gadget), and place rooks at every second bend for the rest of the connection gadget, ending with one rook at the last bend before the clause gadget.
We have placed 4 rooks on each variable gadget, and on each connection gadget we have placed a number of additional rooks equal to half the number of bends. In this way the variable gadgets and connection gadgets are guarded. We also see that the clause gadgets are guarded because the truth assignment satisfies all the clauses, so each clause has a hot edge, and there is a rook on the clause gadget at the end of that hot edge.
Lemma 10. Let C, P (C), and m be as in Lemma 9. If the polyomino P (C) can be guarded by m rooks, then the P3SAT 3 instance C is satisfiable.
Proof. Suppose we have a set of m rooks that guards P (C). Then each clause gadget has at least one guard. We can assume that it is on one of the squares at the end of a connection gadget (if not, we can move it and everything is still guarded). Similar to the proof of Lemma 9, we call those edges the hot edges. We will deduce the truth assignment for which these edges have the same property that defined the hot edges of Lemma 9.
We make the following observation. Given a connection gadget with b bends, if one end is already guarded up through the first bend, then we can guard the remainder with b 2 rooks, but if so, there cannot be a rook past the last bend. To prove this, we can move every rook that appears between bends to the next bend, and then observe that at least every second bend needs a rook.
Next we apply this connection observation to each edge. For each hot edge, we think of the first end as being the one at the clause gadget, which is already guarded by that first rook. The connection observation implies that there must be at least b 2 more rooks on that connection gadget. For each edge that is not hot, we think of the first end as being the one at the variable gadget, which may already be guarded; the connection observation implies that there must be at least b 2 rooks on the connection gadget itself.
Corollary 7 implies that there must be at least four rooks on each variable gadget or up through the first bend of each connection gadget coming out of it. For each hot edge, we need one guard to be shared by the variable gadget and the connection gadget, and this guard has to be at the first bend of the connection gadget, otherwise the connection observation implies that we do not have enough guards. We say the variable is true if it has a hot edge coming into the A side, and say the variable is false if it has a hot edge coming into the B or C side. Then Corollary 7 implies that the variable cannot be both true and false if the gadget is guarded by only four rooks. Thus, with m = 4n + ℓ 2 rooks in total, we have accounted for all the rooks, and so we have found a well-defined truth assignment that satisfies our P3SAT 3 instance C.
Proof of Theorem 3. The polyomino P (C) from Lemma 8 not only is of polynomial size, but in fact can be computed in polynomial time, because finding a visibility representation of a planar graph can be done in linear time [TT86]. Thus there is a polynomial-time algorithm to convert any instance C of P3SAT 3 into a polyomino P (C) and a number m = 4n + ℓ 2 , for which Lemmas 9 and 10 imply that the rookvisibility guard set problem for P (C) and m is equivalent to the P3SAT 3 problem for C. The P3SAT 3 problem is NP-hard [CFF + 08], and thus the rook-visibility guard set problem must also be NP-hard.
The proof of Theorem 4 about queens is similar, but the variable gadget is different and we need to take a little bit more care with the connection gadgets. First we give the queen-variable gadget, shown in Figure 7, and show that it has the properties we need for the rest of the proof.
Lemma 11. The queen-variable gadget cannot be guarded by two queens. It can be guarded by three queens, of which one is at A, or by three queens, of which two are Figure 7. Labeled queen-variable gadget and unique three-queenguards sets.
at B and C. It cannot be guarded by three queens, of which two are at A and B or at A and C.
Proof. That at least three queens are needed to guard the gadget polyomino follows from the fact that no two of the tiles A, B, or C can be guarded by the same queen. We show that there is a unique way to guard the polyomino gadget with three queens if a queen is placed at A. If a queen is placed at A, then none of the tiles C, B, X, Y , Z, and W are guarded by this queen. First, we notice that to guard tiles C and B one queen must be placed at some tile along the row containing B and another queen must be placed at some tile along the row containing C. Also, it is not possible to guard both Y and W with the same queen unless this queen is at Q, but if a queen is placed at Q then it will not be in either of the rows containing B or C. Thus, to guard Y a queen must be placed at either R, S, or T , and to guard W a queen must be placed at either L, U , or V . The only options that also allow to cover tiles X and Z is to place these two queens at R and L. This gives the unique way to guard the gadget polyomino with three queens if one is placed at A. Now, we prove that there is a unique way to guard the polyomino gadget with three queens if two of these queens are placed at B and C. If two queens are placed at B and C, then tiles X, A, and Z are not guarded. The only way to guard these tiles with one more queen is to place it at tile Q, and this position of the third queen guards the rest of the gadget polyomino tiles. This gives the unique way of guarding the gadget polyomino if two queens are placed at B and C.
Finally, as a consequence of the uniqueness of these two three-queen-guard sets, there is no way to guard the polyomino gadget with three queens in such a way that a queen is at A and another queen is either at B or C.
Proof of Theorem 4. Lemma 8, about how to construct the polyomino associated to an instance of P3SAT 3 , applies to queens if we use the queen-variable gadget. We also need to make sure that for each connection gadget, there must be at least three tiles in each segment between bends and in each segment between the last bend and a variable or clause gadget. This is not a concern in the subdivided edge squares, because there is already plenty of space between bends, and only applies to the subdivided node squares-we may need more than a 15 by 15 subdivision of all squares. Then Lemmas 9 and 10 apply to queens, if we replace m = 4n + ℓ 2 by m = 3n + ℓ 2 to account for the fact that the queen-variable gadget needs three queens and not four. In Lemma 10, we use the spacing of the bends in the connection gadgets to ensure that a segment between two bends cannot be guarded entirely by queens beyond those two bends. Using these lemmas as modified for the queen case, we have shown that for every instance of P3SAT 3 , we can compute in polynomial time a polynomial-size instance of the queen-visibility guard set problem that is equivalent. Thus the queen-visibility guard set problem is NP-hard.

Non-Attacking Rooks on Polyominoes
In this section we study the special case of rooks on 2-dimensional polyominoes. In this case we have the convenient tool of being able to encode the attacking relationships between rooks as a bipartite graph. We first construct this bipartite graph, and then in the rest of the section we give some theorems in which we use the properties of the bipartite graph to deduce properties of the rook placements on polyominoes.
In the bipartite graph, the two partite sets are the set of rows and the set of columns of the polyomino. To be precise, we say that two tiles X and Y in a polyomino P are in the same row if the line connecting their centers is horizontal and contained in P . Similarly, two tiles X and Y of a polyomino P are in the same column if the line connecting their centers is vertical and contained in P . This definition of row and column may be counter-intuitive, in that two tiles of P may be in the same row or column of the infinite chessboard without being in the same row or column of P , but it describes the possible lines of attack of rooks on the polyomino.
Given a polyomino P we denote the corresponding bipartite graph by G(P ) = (V, E). The set of vertices is given by V = C ∪ R where C has a vertex for each column and R has a vertex for each row, and the graph includes an edge (c, r) = (r, c) if there is a tile at column c and row r. An example of this construction appears in Figure 8. This bipartite graph is analogous to the one for grid art galleries in [Nta86], and a similar, but not identical, bipartite graph construction appears in the paper [DGH18], which studies the two-player game of placing non-attacking rooks one at a time until the rooks guard the entire polyomino. Another object that records non-attacking rook positions is the chessboard complex, which has one vertex for each tile, and connects sets of tiles that constitute non-attacking positions [BLVŽ94]. It is possible to construct the analogue of the chessboard complex using non-attacking positions for other chess pieces. As far as we know, this is the first time that this chessboard complex is studied in polyominoes that are not rectangular polyominoes. For the purposes of this paper, the bipartite graph G(P ) is the most useful model but the results can be interpreted in terms of the chessboard complex.
The information from the bipartite graph tells us many properties of the polyomino, but studying polyominoes is not identical to studying bipartite graphs. In Figure 8 we show two polyominoes that are not congruent or even topologically equivalent, but their bipartite graphs are isomorphic. And, not all bipartite graphs correspond to polyominoes. For the bipartite graph C 6 , the cycle with six vertices, there does not exists a polyomino P such that G(P ) = C 6 .
The bipartite graph construction is especially useful for studying sets of nonattacking rooks, which correspond to matchings in the graph. A set of rooks is non-attacking if no two rooks are in the same row or column (in the sense defined above), and a matching in any graph is a set of edges that do not share any vertices. Thus, efficient algorithms for finding maximum matchings in bipartite graphs also give maximum non-attacking rook sets in polyominoes.
Theorem 12. There is a polynomial time algorithm to find the maximum number of non-attacking rooks on a polyomino.
Proof. The maximum number of non-attacking rooks on a polyomino P is equal to the maximum number of edges in a matching in the bipartite graph G(P ). A maximum matching in a bipartite graph can be found in polynomial time using an augmenting-path algorithm.
The theorem above can be strengthened to address a rook analogue of the problem from [GJN17], which says that it is NP-hard to decide whether a given set of non-attacking queens can be extended. In the rook case, the problem is polynomialtime solvable, even on polyominoes.
Theorem 13. There is a polynomial time algorithm to decide for any set of m non-attacking rooks on a polyomino and any k > 0, if it can be extended to a set of m + k non-attacking rooks.
Proof. It suffices to show how to decide, for any matching of size m in a bipartite graph G and any k > 0, whether it can be extended to a matching of size m + k. Let M be the matching of size m. Let G ′ be the graph obtained by deleting M , all vertices in M , and all edges incident to those vertices, from G. Then G has a matching of size m + k that contains M if and only if G ′ has a matching of size k. Thus we may solve the problem by running an augmenting-path algorithm on G ′ .
These theorems show that finding maximum-size sets of non-attacking rooks is computationally easy. What about if instead we consider the possible sizes of sets of non-attacking rooks that are maximal, in the sense that no more rooks can be added without destroying the non-attacking property? Recall that a set of rooks is dominating if it guards every square of the polyomino. Thus, a set of nonattacking rooks is maximal if and only if it is dominating. The next lemma shows that the problem of finding the minimum size of maximal set of non-attacking rooks is the same as finding the minimum number of rooks to guard the polyomino, and thus is NP-hard as we have shown in Theorem 3.
Lemma 14. If there exists a set of m rooks that dominates a polyomino P , then there exists a set of at most m non-attacking rooks that dominates P .
Proof. Let t 1 , . . . , t m be the positions of the m rooks that guard P . We consider the rooks in order, moving them around or removing them so that at the ith step, the first i rooks are non-attacking. More precisely, we formally create a new "off the board" position that does not attack anything. Then we find new positions t ′ 1 , . . . , t ′ m that may be off the board, with the property that for each i, the set of rooks at positions t ′ 1 , . . . , t ′ i , t i+1 , . . . , t m still guards P , and the set of rooks at positions t ′ 1 , . . . , t ′ i is non-attacking. To do this, suppose that we have chosen t ′ 1 , . . . , t ′ i−1 . If t i is not in the same row or column as any of these earlier rooks, then set t ′ i = t i . If t i is in the same row as one of the earlier rooks, and also in the same column as one of the earlier rooks, then set t ′ i to be off the board. If t i is in the same row as one of the earlier rooks, but not in the same column as any of them, then we choose t ′ i to be a tile in the same column as t i that is not guarded by any of the earlier rooks, if such a position exists. If every tile in the same column as t i is guarded by one of t ′ 1 , . . . , t ′ i−1 , then we set t ′ i to be off the board. A similar procedure applies to the case where t i is in the same column as an earlier rook, but not in the same row as any of them. In any of these cases we can cause t ′ 1 , . . . , t ′ i to be non-attacking while still guarding the same squares as before and maybe more.
After we have finished this process, the rooks at positions t ′ 1 , . . . , t ′ m , excluding those that are off the board, guard all of the polyomino P and are non-attacking.
Note that this lemma statement is false for queens and for higher-dimensional rooks. For instance, there are polycubes that can be guarded by two higherdimensional rooks but these rooks must attack each other, and similarly for queens.
The next theorem shows that although by Theorem 3 it is NP-hard to determine whether k non-attacking rooks can guard all the squares of a given polyomino, we can still use the bipartite graphs to say something about the values of k for which this is possible.
Theorem 15. Represent by min(P ) the minimum number of non-attacking rooks that dominate a polyomino P and by max(P ) the maximum number of non-attacking rooks that can be placed on P . Then, min(P ) ≥ ⌈max(P )/2⌉ and for any min(P ) ≤ k ≤ max(P ) there exists a dominating set of k non-attacking rooks on P .
Proof. The statement min(P ) ≥ ⌈max(P )/2⌉ follows from the well-known fact that maximal matchings differ in size by at most a factor of 2. Specifically, let M max be a matching of size max(P ) in the bipartite graph G(P ), and let M min be a maximal matching of size min(P ). (The property of dominating the polyomino corresponds to being a maximal matching.) Then every edge of M max shares at least one vertex with an edge in M min , in order not to contradict the maximality of M min ; there are 2 · min(P ) vertices of M min , so there are at most 2 · min(P ) vertices in M max and so min(P ) ≥ ⌈max(P )/2⌉.
To show that there is a dominating set of k non-attacking rooks for every k between min(P ) and max(P ), we start with a maximal matching M min of size min(P ) and apply an augmenting path algorithm. This algorithm repeatedly increases the size of the matching by 1 until it reaches size max(P ); we claim that at each step, the matching remains maximal. Specifically, consider any maximal matching M . Being maximal means that every edge of G(P ) is incident to an edge of M . An augmenting path has odd length and alternates between edges not in M and edges in M , starting and ending with edges not in M . The matching M ′ is obtained from M by swapping whether each edge of the augmenting path is in M or not in M . We observe that M ′ is still maximal, because every vertex of M is still a vertex of M ′ . Thus the augmenting-path algorithm preserves maximality, and the intermediate stages between M min and a maximum-size matching correspond to dominating sets of k non-attacking rooks for all k between min(P ) and max(P ).
If we know that a polyomino admits a given number of non-attacking or dominating rooks, a natural question is to ask when that configuration is unique. We show in Theorem 19 that the maximum-size set of non-attacking rooks is unique in the special case that the polyomino has the smallest possible size that admits a given number of non-attacking rooks. First we show in Theorem 18 that if there are m non-attacking rooks, then the polyomino has at least 2m − 1 tiles. We use Lemmas 16 and 17 to prove Theorem 18.
Lemma 16. Given a polyomino P , the corresponding graph G(P ) is connected.
Proof. Consider an equivalence relation on the tiles of P , generated by the relation that any two tiles that touch along an edge are equivalent. Because the interior of P is connected, all tiles of P are in the same equivalence class. Then we observe that any two tiles that touch along an edge are certainly in the same row or column. Thus, if we generate an equivalence relation by the relation that any two tiles in the same row or column are equivalent, then it is also (even more) true that all tiles of P are in the same equivalence class.
The corresponding construction in G(P ) is to require that any two edges that share a vertex are equivalent. In this case, the connectedness of P implies that all edges in G(P ) are in the same equivalence class. Because any two edges that share a vertex are in the same connected component, this implies that all edges in G(P ) are in the same connected component. Every vertex in G(P ) is in some edge, so G(P ) must be connected.
Lemma 17. In a connected graph G with a matching M of size m there must be at least m − 1 edges not in the matching.
Proof. If M is a matching of size m, then the number of vertices in G is at least 2m. Then, the connectivity of G implies that G has at least 2m − 1 edges. Thus, G has at least m − 1 edges that are not in M .
Using these two lemmas, we are ready to prove Theorem 18.
Theorem 18. The maximum number of non-attacking rooks that can be placed on a polyomino with n tiles is ⌈ n 2 ⌉.
Proof. The polyominoes in the family constructed in Theorem 1 to require ⌊ n 2 ⌋ rook guards also admit ⌈ n 2 ⌉ non-attacking rooks. To show that no polyomino admits more non-attacking rooks, let m be the maximum number of non-attacking rooks on a given polyomino P with n tiles. Then the bipartite graph G(P ) has a matching of size m, so by Lemma 17 there are at least m − 1 edges of G(P ) not in the matching. Thus G(P ) has at least 2m − 1 edges. We know that G(P ) has n edges, so n ≥ 2m − 1 and m ≤ ⌈ n 2 ⌉. In the special case with the minimum number of tiles for the number of rooks, the configuration is unique.
Theorem 19. If a polyomino with an odd number of tiles n = 2m − 1 admits a set of ⌈ n 2 ⌉ = m non-attacking rooks, then this set dominates and is unique. Proof. Suppose for the sake of contradiction that the set of rooks does not dominate. Then there is a square of the polyomino that is not attacked by a rook. We can place an additional rook there to make a set of m + 1 non-attacking rooks, contradicting Theorem 18.
For uniqueness, we show that a connected graph G with 2m − 1 edges cannot have two different matchings of size m. Suppose for the sake of contradiction that there are two matchings M 1 and M 2 , both of size m. Consider the subgraph H of G consisting of all edges that are either in M 1 but not M 2 , or in M 2 but not M 1 . Because G has only 2m vertices, each vertex of G is incident to exactly one edge of each matching, so every vertex of G is incident to either 0 or 2 edges of H. Thus H is a disjoint union of cycles and isolated points. But we know that G is a tree, because it is connected and has 2m vertices and 2m − 1 edges. Thus H cannot have any cycles in it, and so the two matchings are identical.
For uniqueness, it is not enough that the number of non-attacking rooks be maximum given the number of tiles. Some polyominoes with an even number of tiles n = 2m will have more than one set of m non-attacking rooks. In Figure 1 we gave an example of a polyomino with 10 tiles and with more than one set of 5 non-attacking rooks. For instance, another four different configurations can be obtained if we select another rook to guard the center column. The same pattern gives a sequence of polyominoes with n = 2m tiles and more than one set of m non-attacking rooks.
However, there are also some cases where a polyomino with 2m tiles admits only one set of m non-attacking rooks. In Figure 9 we give a family of polyominoes with even number of tiles n = 2m and with a unique set of m non-attacking rooks.
Theorem 20. There exists a sequence of polyominoes with n = 2m tiles, for m ≥ 3, and only one set of m non-attacking rooks.
Proof. The sequence of polyominoes with n = 2m tiles and only one set of m non-attacking rooks is constructed as follows. The first three polyominoes, with m = 3, 4, 5, and their respective sets of m non-attacking rooks are depicted in Figure 9. For m > 3, to recursively construct the polyomino of the sequence with n = 2(m + 1) tiles from the polyomino with n = 2m tiles we add a vertical domino next to the right of the rightmost column of the polyomino, offset from the previous domino so that it creates a new row. The polyominoes constructed with this recursive algorithm have n = 2m tiles and m columns. In order to have a set of m non-attacking rooks, each column most have a rook placed on it. On each one of the polyominoes of the sequence, the third column, from left to right, has only one tile that we represent for the rest of the proof by T . Thus a rook must be placed on T . This forces the rest of the rooks that are on the columns to the right of T , to be placed on the tiles that are not in the same row as T . The tiles that are to the left of T have the same configuration on each one of the polyominoes of the sequence. The leftmost column of each one of these polyominoes has only one tile that is not on the same row as T , thus, a rook must be placed there. This forces us to place a rook on the uppermost tile of the second column from left to right.

Open Questions
In [WK07], Worman and Keil prove that the r-visibility guard set problem is polynomial-time solvable when restricted to polyominoes without holes.
Open Question 1. Is the rook-visibility guard set problem for polyominoes still NPhard if, in addition, we require that the polyomino be simply connected (i.e., not have holes)?
Another question is about the correspondence in Section 4 between polyominoes and bipartite graphs.
Open Question 2. Which bipartite graphs can be written as G(P ) for some polyomino P ? For those that can, is there a good algorithm for reconstructing P ? Can we deduce anything about the number or size of holes in P just from knowing G(P )?
For higher-dimensional rooks, the bipartite graph construction does not work.
Open Question 3. For d-dimensional rooks on d-polycubes, what are the analogues of the theorems in Section 4? Can we prove similar results even without the bipartite graphs?
Theorem 15 suggests that an entertaining recreational puzzle may be to give someone a polyomino P and a number k, and to ask that person to produce a dominating set of k non-attacking rooks on P .
Open Question 4. For which choices of P and k is the task of finding a dominating set of k non-attacking rooks on P of appropriate difficulty for a human? What is a good method for producing such P and k by computer?
We can also ask about random polyominoes; several probability distributions on polyominoes are given in [Rol18]. We know that the minimum number of rooks needed to guard a given n-omino ranges between 1 (for a single-row polyomino) and ⌊ n 2 ⌋ (as in Theorem 1), and that the maximum number of non-attacking rooks ranges between 1 and ⌈ n 2 ⌉. Open Question 5. What is the expected value of the minimum number of rooks needed to guard a typical n-omino? Is it bounded below by a linear function of n? How about the maximum number of non-attacking rooks?