1 Background and definitions

Sliding/pushing puzzles are classical problems used for entertainment. In a sliding puzzle, entities (often described as robots) are moving around on a grid, and trying to reach a final position. Every time a robot starts a move in a direction, it slides and cannot stop until it hits another element on the grid (a wall, a block or another robot). In a pushing puzzle, the entities often may stop a move without hitting a wall, but mostly they are also allowed to move some inert blocks by pushing them. Pushing games exist on their own (e.g. Sokoban) or as puzzles inside video games (e.g. Zelda). They have been thoroughly studied before, and we refer the reader to the pleasant survey of Demaine (2001) which also provides a classification of these games. He gives a very detailed overview of known computational complexity results about such games. Without any surprise, a large majority of these are proved to be NP- or PSPACE-complete. A distinction is also made between push and pushpush-games: in the first game the blocks are pushed one square at a time, while in the second they slide until they meet an obstacle whenever they are pushed.

Sliding games are still less studied, though there are many commercial games using this principle. Rasende roboter, lunar lockout (marketed in 1999 by Binary Arts) or its predecessor UFO are such examples. Before describing these games, we propose a general definition. An ice slide game is a puzzle where one or more robots are on a grid, trying to reach a flag [the name was initially given in TCS questions & answers Website (2012)]. By reaching the flag, we mean going through it and not necessarily stoping on it. Each move of a robot consists in sliding in one direction until it meets an obstacle, which stops him. Obstacles include static obstacles, such as walls or blocks, but also other robots. In such a setting, the natural question is whether there is a sequence of moves for one robot to reach the flag. See Fig. 1 for an example of this game.

Fig. 1
figure 1

Robot sliding game: a solution with six moves

This question, where obstacles are predefined, and a single robot is trying to reach a final position was posed recently by Burke (2012), on his excellent blog devoted to combinatorial game theory. Burke also asked for the minimum number of moves for the robot to reach the goal. Actually, the resolution of this problem is not very hard, as explained in TCS questions & answers Website (2012). Indeed, it reduces to the search for a shortest path between the starting and final squares in an underlying subgraph of the grid. By way of consequence, a simple application of Djikstra’s algorithm yields to a polynomial computation of the minimum number of moves of a solution (provided the game representation is not sublinear in the number of squares).

Yet, another natural question arises when dealing with this problem: what if the player can choose the positions of the obstacles on the board? Of course, if the initial and final squares are fixed, at most one block is necessary, yielding to a solution with at most two moves. But if we ask the player to be able to move the robot to reach any position, the problem becomes considerably more challenging. More precisely, given an initial square P of the grid, we ask what is the minimum number of blocks needed (and also how they must be placed) to move the robot from P to any other square. In that context, the question of the minimum number of moves becomes secondary. Note that this problem can be considered as a good way to build new configurations for the original Rasende Roboter game. Indeed, if one can ensure that the robot can reach every square of the board, it provides game configurations where the flag can be placed everywhere (Fig. 2).

Fig. 2
figure 2

\(\iota \sigma _{B}^{P}(G_{4,4})\le 2\)

Fig. 3
figure 3

\(\iota \sigma _{W}^{S}(G_{4,4})\le 9\)

In correlation with this problem, we have identified two research parameters that slightly change the rules detailed above but raise new reflection on the topic:

  • Blocks can be substituted by walls in the problem. In other words, the robot bounces when hitting an edge of the grid (instead of a square), as depicted in Fig. 3.

  • Instead of just passing through the final square, the robot must stop on it. Note that, if there is only one robot, it forces any square of the grid to be adjacent to a block (or a wall).

In the following, we differentiate four situations of the game, depending on the precise question and the nature of the obstacles. We denote the game ice slide \(_{B/W}^{P/S}\)-K using a superscript P or S depending whether we require that the robot simply Passes or need to Stop on the flagged position, a subscript B or W depending whether the obstacles are Blocks or Walls, and K for the number of robots that we are allowed to move.

For example, the marketed game Rasende roboter Footnote 1 is related to the game ice slide \(_{W}^{S}\)-4 with a particular setting of the obstacles. In Rasende roboter, the objective is to find the minimum number of moves of a solution where the initial and final positions are fixed. Its originality is that three additional robots can also be moved and be used as blocks on which bouncing could help the player. Rasende roboter had a good marketing success and also raised research interest in algorithmic game theory. Because of the presence of other robots and the size of the grid (\(16\times 16\)), simple shortest path algorithms are no more efficient. To the best of our knowledge, only AI algorithms based on multi-agent systems have been proposed to solve the game (Butko et al. 2006).

Another popular game called lunar lockout (marketed in 1999 by Binary Arts) is very close to ice slide \(_{B}^{S}\)-K, with a board with no bounding walls. As in Rasende roboter, other robots can be used as movable blocks. Before its marketing, this puzzle was first introduced in 1998 by Yoshigahara and called UFO. It was studied in the literature under this original name. Hock proved in (2001) that deciding the existence of a solution in UFO is NP-complete. In Hartline and Libeskind-Hadas (2003), a variant of UFO is proposed, called GLLV, where robots with a fixed location are allowed and played on a general rectangular grid. This version clearly meets ice slide \(_{B}^{S}\)-K. Whereas the PSPACE-completeness of UFO is open, it is proved in Hartline and Libeskind-Hadas (2003) that GLLV is PSPACE-complete.

Note that the two games ice slide \(_{B/W}^{P}\)-2 played on a rectangular grid are trivial, in the sense that no block is needed. Engels and Kamphans (2005) proved that the two games ice slide \(_{B/W}^{S}\)-3 are also trivial in any rectangular grid. Hence the most interesting instances, at least on rectangular grids, seem to be ice slide \(_{B/W}^{P/S}\)-1 and ice slide \(_{B/W}^{S}\)-2. In this paper, we will focus on the games ice slide \(_{B/W}^{P/S}\)-1, using a single robot, and denote them simply by ice slide \(_{B/W}^{P/S}\). We use the following definition.

Definition 1

Let \(G_{n,m}\) be a rectangular grid with n rows and m columns. Each square of the grid is denoted by a pair (ij) with \(1\le i \le n\) and \(1\le j\le m\). The parameter \(\iota \sigma _{B/W}^{P/S}(G_{n,m})\) is the minimum number of Blocks (resp. Walls) that needs to be placed on the grid so that, from the starting position (1, 1) and for every position (ij) of \(G_{n,m}\) which does not contain a block, there exists a sequence of moves making the robot Pass over (resp. Stop on) (ij).

Remark 2

In what follows, we shall see that starting from the position (1, 1) is not very restrictive. Indeed, our constructions often guarantee that from any starting position, it is possible to move the robot and stop on (1, 1).

Remark 3

In the definition, one can replace the rectangular grid by any kind of grids for which the moves of the robot is clear. For example, in Sect. 3, we consider king grids and tori.

We proceed with the resolution of these problems for several instances, stressing how this game is related to some well-known problems in graph theory. In Sect. 2, we first give the definitions and results of related graph problems. In Sect. 3, we study \(\iota \sigma _{B}^{P}\) on different kinds of grids, such as rectangular grids, king grids and tori. In Sect. 4, the three other variants of the game are explored.

2 Graph parameters related to ice slide

The current section presents two optimization problems in graph theory which correlate with our game.

Domination in graphs

Given a graph G, a set \(D\subseteq V(G)\) is said to be a dominating set (resp. a total dominating set) of G if every vertex of \(V(G){\setminus } D\) (resp. V(G)) is adjacent to a vertex of D.

Definition 4

Let G be a graph. The value \(\gamma (G)\) (resp. \(\gamma _t(G)\)), called domination number (resp. total domination number) of G, corresponds to the minimum cardinality of a dominating set (resp. total dominating set) in G.

In the next section, we relate the dominating set problem with ice slide \(_{B}^{S}\). Indeed, the ability to stop the robot anywhere means that a block must be adjacent to any square of the grid. In other words, the set of blocks needs to be a dominating set of the grid. Total dominating sets appear in the study of the game ice slide \(_{B}^{P}\), as explained further in Sect. 3.1.

Given any graph G, the computation of \(\gamma (G)\) and \(\gamma _t(G)\) are known to be NP-hard problems. However, their values are known for simple classes of graphs, such as grids or paths. As needed later, we give below the total domination number of paths.

Proposition 5

(Klobucar 2004). Let \(P_n\) denote the path with n vertices. We have

$$\begin{aligned} \gamma _t(P_n)=\left\{ \begin{array}{ll} 2\lfloor \frac{n}{4}\rfloor + 1 &{}\quad \text{ if } n\equiv 1\pmod 4\\ 2\lfloor \frac{n}{4}\rfloor &{}\quad \text{ otherwise } \end{array} \right. \end{aligned}$$

Edge cover in graphs

Given a graph G, a set \(S\subseteq E(G)\) is said to be an edge cover of G if every vertex of G is incident to at least one edge of S.

Definition 6

Let G be a graph. The value \(\rho (G)\), called the edge covering number of G, corresponds to the size of a minimum edge cover of G.

Unlike the domination number, the value \(\rho (G)\) can be computed in polynomial time for any graph G. In Sects. 4.2 and 4.3, we observe how edge covers interact with the game ice slide played with walls. For example, we use the value \(\rho (P_n)\), which is straightforwardly equal to \(\lceil n/2\rceil \).

3 ice slide \(_{B}^{P}\) played on various grids

Throughout this paper, we consider grids with n rows and m columns. We denote by \(R_i\) (resp. \(C_j\)) the \(i{\mathrm{th}}\) row (resp. \(j{\mathrm{th}}\) column) of G. Position (ij) is at the intersection of \(R_i\) and \(C_j\). In the figures, unless something else is mentioned, (1, 1) is the top-left square.

3.1 Rectangular grids

In this part, we consider the game ice slide \(_{B}^{P}\) on a rectangular grid \(G=G_{n,m}\): we place blocks on G and the robot must be able to pass everywhere from the square (1, 1).

Definition 7

Let B be a set of blocks. The row \(R_i\), \(2\le i\le n-1\) (resp. column \(C_j\), \(2\le j\le m-1\)) is said to be totally dominated by B if there is at least one block of B in row \(R_{i-1}\) or \(R_{i+1}\) (resp. in column \(C_{i-1}\) or \(C_{i+1}\)).

If B is a set of blocks in \(G_{n,m}\) which totally dominates every column \(C_j\), \(2\le j\le m-2\), then, by moving blocks from columns \(C_1\) and \(C_m\) to columns \(C_3\) and \(C_{m-2}\) respectively, every column is still totally dominated by B. Hence we get the following:

Observation 8

If B is a set of blocks in \(G_{n,m}\) which totally dominates every column \(C_j\), \(2\le j\le m-2\), then \(|B|\ge \gamma _t(P_{m-2})\).

Proposition 9

For each \(n\ge m\), we have \(\iota \sigma _{B}^{P}(G_{n,m})\ge \gamma _t(P_{m-2})\).

Proof

Consider an optimal solution B of ice slide \(_{B}^{P}\) for \(G_{n,m}\). If every column \(C_j\), \(2\le j\le m-2\), is totally dominated by B then, by Observation 8, we get \(\iota \sigma _{B}^{P}(G_{n,m})\ge \gamma _t(P_{m-2})\).

Assume now that there exists a column \(C_{j}\), \(2\le j\le m-2\), which is not totally dominated by B. Let \(I_j=\{i:(i,j)\in B\}\) be the line indices of the blocks of \(C_j\). The robot can not initiate a vertical move in \(C_j\) since to stop in \(C_j\) it needs a block in column \(C_{j-1}\) or \(C_{j+1}\). Hence it has to go horizontally through every row \(R_i\), \(i\in [2,n-1]{\setminus } I_j\). Therefore, each such row must be totally dominated by \(B'=B{\setminus } \{(i,j):i\in I_j\}\). We define the set of blocks \(B^*\) as follows:

$$\begin{aligned} B^*=B' \cup \{(i-1,j):i\in I_j, i>1\}. \end{aligned}$$

We claim that each row \(R_i\), \(2\le i\le n-1\), is totally dominated by the set \(B^*\). Indeed, if \(i\notin I_j\), then \(R_i\) is totally dominated by \(B'\) as observed above. Otherwise there is a block in row \(R_{i-1}\). We finally get

$$\begin{aligned} |B|\ge |B^*|\ge \gamma _t(P_{n-2}) \ge \gamma _t(P_{m-2}) \end{aligned}$$

by Observation 8 and the result follows. \(\square \)

Lemma 10

Assume that the pattern \(P_n\) of size \(n\times 8\) depicted on Fig. 4a is in position (1, j) ((1, j) being the top-left square of the pattern). Then, if a robot is able to enter horizontally in all the four positions (1, j), (nj), \((2,j+7)\), and \((n-1,j+7)\), it can pass vertically through all the columns \(C_j\) to \(C_{j+7}\). In addition, if a robot enters horizontally the pattern \(P_n\) in position (1, j), it can leave it horizontally on rows \(R_2\) and \(R_{n-1}\) heading left and on rows \(R_1\) and \(R_n\) heading right (see Fig. 4b).

Proof

The routes followed by the robot to satisfy the above lemma are shown on Fig. 4. \(\square \)

Fig. 4
figure 4

Pattern of size \(n\times 8\) for ice slide \(_{B}^{P}\) on grid and its representation. a Moving inside \(P_n\). b Leaving \(P_n\)

Theorem 11

For any \(n\ge m\), \(m\ne 10\), we have \(\iota \sigma _{P}^{B}(G_{n,m})=\gamma _t(P_{m-2})\).

For any \(n\ge 10\), we have \(\iota \sigma _{P}^{B}(G_{n,10})=5\).

Proof

Let \(n\ge m > 10\). We consider the following cases:

  • \(m-2\equiv 3,4,5,6\) or \(7\pmod 8\). The solution is built by gluing \(\lfloor \frac{m-2}{8}\rfloor \) copies of \(P_n\) starting from column \(C_2\) (leaving column \(C_1\) empty), the remaining columns being filled by the patterns of Fig. 5. From Lemma 10, all the columns of all the copies of \(P_n\) but the last one are visited. Figure 5 shows that all the remaining rightmost columns can be visited by entering from the left on rows \(R_1\) and \(R_n\). The robot is also able to leave these columns from rows \(R_2\) and \(R_{n-2}\), so that the columns of the last copy of \(P_n\) can be visited.

  • \(m-2\equiv 1\) or \(2\pmod 8\). Using \(\lfloor \frac{m-10}{8}\rfloor \) copies of \(P_n\), the proof is similar to the previous case using the patterns depicted in Fig. 6.

  • \(m-2\equiv 0\pmod 8\). The proof is again similar using \(\lfloor \frac{m-18}{8}\rfloor \) copies of \(P_n\) (recall that \(m\ne 10\)) and the pattern depicted in Fig. 7.

Fig. 5
figure 5

Visiting the remaining columns when \(m-2\equiv 3,4,5,6,7\pmod 8\). a \(m-2\equiv 3\pmod 8\). b \(m-2\equiv 4\pmod 8\). c \(m-2\equiv 5\pmod 8\). d \(m-2\equiv 6\pmod 8\). e \(m-10\equiv 7\pmod 8\)

Fig. 6
figure 6

Visiting the remaining columns when \(m-10\equiv 1,2\pmod 8\). a \(m-10\equiv 1\pmod 8\). b \(m-10\equiv 2\pmod 8\)

We now consider the case \(m<10\), \(n\ge m\). If \(m=1,2\), clearly no block is needed. For \(m=3\), put a block in position (n, 3). For \(m=4\), put two blocks in positions (n, 3) and (1, 4). For \(5\le m\le 9\), leave column \(C_1\) empty glued to the pattern of width \(m-1\) given in Fig. 5.

In each case, the number of blocks used in our solutions is exactly \(\gamma _t(P_{m-2})\).

Fig. 7
figure 7

Visiting the remaining columns when \(m-18\equiv 0\pmod 8\)

In the case \(m=10\), one can easily show that five blocks are enough by using the pattern of Fig. 6a without the first column. It now remains to be proven that \(\gamma _t(P_8)=4\) blocks are not sufficient. Suppose, on the contrary, that \(\iota \sigma _{B}^{P}(G_{n,10})=\gamma _t(P_8)=4\) for \(n\ge 10\), and consider an optimal solution B. According to the proof of Proposition 9, one can assume that every column \(C_j\), \(2\le j\le m-2\) is totally dominated by B. There exists a unique minimum total dominating set in \(P_8\), depicted in Fig. 8. Consequently, the four blocks of B are located in columns \(C_3,C_4,C_7\) and \(C_8\).

Fig. 8
figure 8

Minimum total dominating set in \(P_8\)

Now, since column \(C_2\) is totally dominated by column \(C_3\), the block in \(C_3\) is necessarily located on the first or last row. Otherwise, it would not be possible to make the robot stop in column \(C_2\) since there is no block in \(C_1\). By symmetry, the block in \(C_8\) is also located on the first or last row. Now, with the same argument, since \(C_3\) is totally dominated by \(C_4\) and there are no blocks in \(C_1\) and \(C_2\), the only way to make the robot stop on column \(C_3\) is to place the block of \(C_4\) in the first or last row, and not adjacent to the block in \(C_3\). Ditto for the block in \(C_7\). There are thus only 4 possible sets for B, but for each of them, the position (1, 5) is not reachable. \(\square \)

Remark 12

Note that our constructions preserves the accessibility of the robot to every square of the grid if the starting position is different from (1, 1). Indeed, one can verify that from any position in \(P_n\) or in the ending patterns, there exists a sequence of moves landing in (1, 1).

3.2 Tori

We now consider the torus grid \(T_{n,m}\) and compute the value \(\iota \sigma _{B}^{P}(T_{n,m})\) for any values of n and m. Indices are taken modulo m for columns and modulo n for rows.

We first give a lower bound, similar to Proposition 9.

Proposition 13

For any \(n\ge m\), \(\iota \sigma _{B}^{P}(T_{n,m})\ge \lceil frac{m-1}{2} \rceil \).

Proof

Consider an optimal solution B of ice slide \(_{B}^{P}\) for \(T_{n,m}\). If for every column \(C_j\) which is not the starting column of the robot, there is a block in column \(C_{j-1}\) or \(C_{j+1}\), then there are at least \(\frac{m-1}{2}\) blocks in the solution.

Hence we assume that there exists a column \(C_j\), not the starting column of the robot, such that there is no block in columns \(C_{j-1}\) and \(C_{j+1}\). Let \(n_j\) be the number of blocks in column \(C_j\). The robot cannot go vertically in column \(C_j\) since to stop in column \(C_j\) it needs a block in column \(C_{j-1}\) or \(C_{j+1}\). Hence it has to go horizontally through the \(n-n_j\) free squares of the column. But to go horizontally on row \(R_i\), either the robot starts on this row, or there is a block in row \(R_{i-1}\) or \(R_{i+1}\). Thus, to go through the \(n-n_j\) free squares of \(C_j\), the robot needs at least \(\frac{n-n_j-1}{2}\) blocks. Note that these blocks are not on column \(C_j\). At the end, the solution has at least \(\frac{n-n_j-1}{2}+n_j\ge \frac{m-1}{2}\) blocks. \(\square \)

We will prove that this lower bound is reached for \(m\ge 6\). For that, we will prove by induction the following stronger statement:

Proposition 14

For any \(m\ge 6\), there exists a solution of ice slide \(_{B}^{P}\) on \(T_{m,m}\) with \(\frac{m-1}{2}\) blocks, such that:

  1. 1.

    if \(i_m\) is the maximum index of a row with a block, the robot can pass horizontally on the row \(R_{i_m+1}\),

  2. 2.

    the robot can pass vertically on all the columns.

Proof

We will use for the induction the pattern of size \(4\times 8\) of Fig. 9. The figure gives a proof of the following lemma:

Lemma 15

Assume that the pattern of Fig. 9 is in position (ij) ((ij) is the top-left square of the pattern) and that there is no block in any column and row intersecting the pattern (i.e. rows \(R_i\) to \(R_{i+3}\) and columns \(C_j\) to \(C_{j+7}\)). Then, if a robot enters in position (ij) horizontally in the pattern of Fig. 9, it can pass vertically on all the columns \(C_j\) to \(C_{j+7}\) and can go out of the pattern horizontally on rows \(R_{i-1}\) and \(R_{i+4}\) (by wrapping around the torus), in any direction.

Using this pattern, if we know a solution for \(T_{m,m}\) of size \(\frac{m-1}{2}\) satisfying Conditions (1) and (2) of the proposition, we can get a solution for \(T_{m+8,m+8}\) of size \(\frac{m-1}{2}+4\) still satisfying the conditions. Indeed, one can copy the solution of \(T_{m,m}\) and if \(i_m\) (resp. \(j_m\)) denotes the largest index of a row (resp. a column) containing a block, add the pattern in position \((i_m+1,j_m+1)\) (see Fig. 10).

Fig. 9
figure 9

Pattern for ice slide \(_{B}^{P}\) on torus and its representation

Fig. 10
figure 10

Construction of a solution for \(T_{m+8,m+8}\) from a solution of \(T_{m,m}\). Conditions 1 and 2 of Proposition 14 remain satisfied

Hence we just have to prove the proposition for \(m=6\) to \(m=13\). This is proved by Fig. 11. On this figure, we show the solutions for odd m. We get the solutions for even m by removing the row and the column in gray. \(\square \)

Fig. 11
figure 11

Small cases for induction for ice slide \(_{B}^{P}\) on torus. Since all columns are passed vertically, we highlight only the significant rows. To get the even grids, remove the gray row and column. a \(m=6,7\). b \(m=8,9\). c \(m=10,11\). d \(m=12,13\)

Since all the columns are passed vertically, we can add as many rows as we want to the torus and we get optimal solutions for \(T_{n,m}\) with \(n\ge m \ge 6\):

Corollary 16

For \(n\ge m\ge 6\), \(\iota \sigma _{P}^{B}(T_{n,m})=\frac{m-1}{2}\)

We now complete the study with the small values of m:

Proposition 17

We have:

  • \(\iota \sigma _{P}^{B}(T_{n,1})=0\)

  • \(\iota \sigma _{P}^{B}(T_{n,2})=n-2\)

  • \(\iota \sigma _{P}^{B}(T_{n,3})=3\)

  • \(\iota \sigma _{P}^{B}(T_{n,4})=3\)

  • \(\iota \sigma _{P}^{B}(T_{n,5})=3\)

Proof

The case \(m=1\) is trivial.

If \(m=2\), assume that the robot starts at position (1, 1). Then it can only go vertically on column 1, horizontally on row 1 and eventually horizontally on two more rows \(i-1\) and \(i+1\) if there is a block in position (i, 1). Hence \(n-3\) squares are not reachable and we need to add blocks on these squares.

For \(m\in \{3,4,5\}\), assume, by contradiction, there is a solution with starting position (1, 1) and two blocks in positions \((i_1,j_1)\) and \((i_2,j_2)\). We must have \(1\in \{i_1,j_1,i_2,j_2\}\). Assume that \(i_1=1\) (other cases are similar). We have \(j_1\ne 1\), \(j_1\ne j_2\) and \(i_2\ne 1\) (otherwise the robot can not go everywhere). Then one can check that the robot can not go in position \((i_2,j_1)\), which leads to a contradiction. Blocks in positions \(\{(1,2),(2,3),(3,1)\}\) is a solution with three blocks that works for \(m\in \{3,4,5\}\). \(\square \)

Remark 18

In the torus, all the positions are equivalent. Also, if we know the starting position before placing the blocks, we can always use our constructions. However, if the solution must work for any starting position, then we need at least \(\min (n,m)\) blocks. Indeed, if there exists a row \(R_i\) and a column \(C_j\) with no block, a robot starting in (ij) will never be able to leave the squares of \(R_i\cup C_j\).

3.3 King grids

We now consider the game ice slide \(_{B}^{P}\) played on the King grid \(n\times m\), denoted \(\mathcal {K}_{n,m}\), also known as the strong product of two paths \(P_n\boxtimes P_m\). In the King grid, the robot is also allowed to initiate moves diagonally. We begin with the following surprising result about King grids.

Theorem 19

Let \(m\ge n\) be positive integers.

If \(\gcd (n,m)\le 3\), then \(\iota \sigma _{B}^{P}(\mathcal {K}_{n+1,m+1})=0\).

Proof

Let \(m\ge n\) be positive integers such that \(\gcd (n,m)\le 3\), and consider the game on the King grid \({\mathcal {K}_{n+1,m+1}}\). We first observe that the robot can stop on all positions \((1,1+ \alpha n - \beta m)\) where \(0\le \alpha n - \beta m \le m\) (see Fig. 12a). From (1, 1), the robot can go diagonally to \((1+n,1+n)\) then up to \((1,n+1)\). Iterating the process, it reaches \((1, 1+ \alpha n)\) for all \(0\le \alpha \le \frac{m}{n}\). Eventually, the robot reaches the position \((1,1+\lfloor \frac{m}{n}\rfloor n)\). Then, going diagonally, it reaches \((1+m-\lfloor \frac{m}{n}\rfloor n, m+1)\), then can slide to \((1+m-\lfloor \frac{m}{n}\rfloor n, 1)\), and can continue diagonally its movement to \((1+n,1+(\lfloor \frac{m}{n}\rfloor +1) n -m)\) from which it can go up to \((1,1+(\lfloor \frac{m}{n}\rfloor +1) n -m)\). Iterating the same process, we get that it reaches all positions \((1,1+ \alpha n - \beta m)\) where \(0\le \alpha n - \beta m \le m\). Then, thanks to Bézout’s identity, we deduce that the robot reaches all positions \((1,1+\alpha \gcd (m,n))\) where \(0\le \alpha \le \frac{m}{\gcd (m,n)}\).

Now, if \(\gcd (m,n)=1\), from these positions, the robot can pass vertically any position. If \(\gcd (m,n)=2\), then the robot passes vertically all positions \((x, 1+2y)\). From \((1, 1+2y)\), it can also reach by a diagonal \((1+2y,1)\), and thus can pass horizontally all \((1+2x, y)\). Positions (2x, 2y) can be reached from either \((1+2(x-y), 1)\) (if \(x\ge y\)) or from \((1,1+2(y-x)\)) (otherwise). So the robot can pass all positions. Finally, if \(\gcd (m,n)=3\), the robot can pass vertically all \((x,1+3y)\) and horizontally all \((1+3x,y)\). The positions \((2+3x, 2+3y)\) and (3x, 3y) can be reached diagonally from \((1+3(x-y),1)\) or from \((1,1+3(y-x))\). The positions \((3x,2+3y)\) and \((3x-1,3y)\) can be reached diagonally from \((n+1,3(y+x)-n+1)\) or from \((3(y+x)+1,1)\). \(\square \)

Fig. 12
figure 12

Block pass in the king grid. a On \(\mathcal {K}_{n+1,m+1}\) when \(\gcd (n,m)=3\), the robot can stop on grey squares. b How we use blocks

Theorem 20

For \(m\ge n\) positive integers, we have

$$\begin{aligned} \iota \sigma _{B}^{P}(\mathcal {K}_{n+1,m+1})\le \left\lceil \frac{\gcd (n,m)-3}{8}\right\rceil \,. \end{aligned}$$

Proof

Let \(k=\left\lceil \frac{\gcd (n,m)-3}{8}\right\rceil \), we prove now that using k blocks, the robot may pass on every unoccupied position. For \(0\le i<k\), we place a block \(B_i\) on position \((n+1, n+1-2i)\) when i is even, and \((1,n+1-2i)\) when i is odd (see Fig. 13).

We first prove by induction that the robot can reach position \((1,n+1-j)\) or position \((n+1,n+1-j)\) for all \(0\le j\le 2k\), and thus, with two diagonal moves and possibly one vertical move, the robot also reaches positions \((1,1+j)\) and \((n+1,1+j)\). Let j be an even positive integer in the range \(0\le j\le 2k-2\), and assume the robot can reach the positions \((1,1+j)\) and \((n+1, 1+j)\). The base case, when \(j=0\), is obvious. If j is even, from \((1,j+1)\), the robot can slide to \((j+1,1)\) then to \((n,n-j)\) where it get stopped by block \(B_{\frac{j}{2}}\) (see Fig. 12b). Then it can go up to \((1,n-j)\) and diagonally to \((n+1,n-j-1)\), proving the property for \(j+1\) and \(j+2\).

From these positions, with similar arguments as in the previous lemma, we get that the robot can always reach positions of type \((1,1+\alpha \gcd (n,m)-j)\) or \((n+1,1+\alpha \gcd (n,m)-j)\) as well as \((1+\alpha \gcd (n,m)+j,1)\) or \((1+\alpha \gcd (n,m)+j,n+1)\) with \(0\le j\le 2k\) (see Fig. 13). So consider now a position of type \((1+\alpha \gcd (n,m)+x,1+\beta \gcd (n,m)+y)\) where x and y are larger than 2k but less than \(\gcd (n,m)-2k\le 6k+3\). If \(|x-y| \le 2k\), then the robot can reach that position by sliding diagonally from \((1+(\alpha -\beta )\gcd (n,m)+(x-y),1)\) or \((1,1+(\alpha -\beta )\gcd (n,m)+(x-y))\). If \(|x-y|\ge 2k+1\), we deduce that

$$\begin{aligned} x+y-gcd(n,m)&\le 2(gcd(n,m)-2k-1)-(2k+1)-gcd(n,m)\le 2k \\ x+y-gcd(n,m)&\ge 2(2k+1)+2k+1 -gcd(n,m)\ge -2k \end{aligned}$$

Therefore, if \(y'=1+\alpha \gcd (n,m)+x + n+1-(1+\beta \gcd (n,m)+y)\) is non negative, then it can be written in the form \(1+\gamma \gcd (n,m)+j\) or \(1+\gamma \gcd (n,m)-j\) where \(0\le j\le 2k\), and the position can be reached diagonally from \((n+1,x')\), otherwise \(x' = n+1 - y'\) and then the position can be reached from \((x',1)\). \(\square \)

Fig. 13
figure 13

Two blocks for the King grid \(\mathcal {K}_{20,20}\)

When \(\gcd (m,n)>3\), it is not difficult to verify that there is no solution without any block, by checking all the possible moves. We can observe that there is no possibility to reach the position (2, 3) for example. However, we do not have any general proof that our bound is optimal, and we leave it as an open question.

4 Other instances of ice slide

4.1 ice slide \(_{B}^{S}\)

In what follows, we consider the game ice slide played with blocks on a grid where the robot has to stop on each square. An inner square of the grid is a square (ij) such that \(2\le i \le n-1\) and \(2\le j\le m-1\). Other squares are called border squares.

We obtain the following lower bound for \(\iota \sigma _{B}^{S}(G_{n,m})\):

Proposition 21

For each \(n\ge m \ge 3\), we have \(\iota \sigma _{B}^{S}(G_{n,m})\ge \gamma (G_{n-2,m-2}).\)

Proof

Consider an optimal solution B of ice slide \(_{B}^{S}\) on \(G_{n,m}\). Let (ij) be an inner square of the grid. There must be at least one block adjacent to (ij) otherwise the robot cannot stop on it. Let \(G'\) be the grid induced by the inner squares. It is isomorphic to \(G_{n-2,m-2}\). Let \(B_1\) be the set of blocks of B that are located on inner squares. Let \(V_b\) be the set of squares of \(G'\) that are not adjacent to a block of \(B_1\). Note that all these squares are on the border of \(G'\), and that, for each square (ij) of \(V_b\), there is at least one block on an adjacent square of (ij) in the border of \(G_{n,m}\). Thus we have \(|B| \ge |B_1|+|V_b|\). Now let us consider \(B'\) defined as the disjoint union of \(B_1\) and \(V_b\). Clearly, \(B'\) is a dominating set of \(G_{n-2,m-2}\), and we have \(|B'|\le |B|\). Hence we have:

$$\begin{aligned} \iota \sigma _{B}^{S}(G_{n,m})=|B|\ge |B'|\ge \gamma (G_{n-2,m-2}). \end{aligned}$$

\(\square \)

We now give a construction of a solution of ice slide \(_{B}^{S}\) on \(G_{n,m}\).

Proposition 22

For any \(n\ge m \ge 2\), we have

$$\begin{aligned} \iota \sigma _{B}^{S}(G_{n,m})\le \gamma (G_{n-2,m-2}) +\frac{18}{25}(m+n)+\frac{28}{5}. \end{aligned}$$

Proof

Let \(n\ge m\ge 2\).

We construct a solution B of ice slide \(_{B}^{S}\) in three steps. The construction is illustrated on Figs. 14 and 15.

Let first \(B_1\) be the set of blocks that are the translation of the block located on square (1, 2) by linear combinations of the two vectors \(\{(1,2), (3,1)\}\) (see Fig. 14). Note that \(B_1\) covers all the inner squares of \(G_{n,m}\) and that each inner square is covered exactly once.

Let us call \(B_1'\) the subset of blocks which are located on the border. By construction, there are at most \(2\left( \left\lceil \frac{n-2}{5} \right\rceil +\left\lceil \frac{m-2}{5} \right\rceil \right) \le \frac{2}{5}(m+n)+2\) such blocks. Clearly, the blocks of \(B_1'\) cover a subset \(S'\) of the inner squares such that \(|B_1'|=|S'|\).

Let us denote \(S''\) the set of inner squares which are not in \(S'\). Since each inner square is covered exactly once, then the subset \(B_1''\) of blocks of \(B_1\) that are located on inner squares satisfies \(5|B_1''|=|S''|\).

On the other hand, since each square of the grid has at most four neighbours, then we have \(\gamma (G_{n-2,m-2}) \ge \frac{1}{5}(|S'|+|S''|)\). Hence we have \(\gamma (G_{n-2,m-2}) \ge \frac{1}{5}|B_1'| + |B_1''|\), and since \(B_1\) is the disjoint union of \(B_1'\) and \(B_1''\) then we have \(|B_1| \le \gamma (G_{n-2,m-2}) +\frac{8}{25}(m+n)+\frac{8}{5}\).

The blocks of \(B_1\) will be enough to ensure that the robot will be able to stop on almost each inner square as soon as it may reach some of them. Indeed, if the robot enters in a rectangle of size \(4\times 4\) that has four blocks on its border (see as an example the gray rectangle on Fig. 14), then it will be able to stop in the four inner squares of this rectangle and thus to go out of the rectangle from these four places (see Fig. 15). To ensure that the robot will be able to enter in those rectangles from the border of the grid and to stop on the border, we add some blocks that will form the set \(B_2\).

Fig. 14
figure 14

Solution of ice slide \(_{B}^{S}\) on \(G_{8,10}\)

Fig. 15
figure 15

Pattern of the solution of ice slide \(_{B}^{S}\)

For each block of \(B_1\) located on an inner square which is neighbour of a border square, we add a block in \(B_2\) in the following way:

  • for each block \((2,j)\in B_1\), we add the block (1, j) to \(B_2\);

  • for each block \((n-1,j)\in B_1\), we add the block (nj) to \(B_2\);

  • for each block \((i,2)\in B_1\), we add the block (i, 1) to \(B_2\);

  • for each block \((i,m-1)\in B_1\), we add the block (im) to \(B_2\).

By construction, we have \(|B_2|\le 2\left( \left\lceil \frac{n-2}{5} \right\rceil +\left\lceil \frac{m-2}{5} \right\rceil \right) \le \frac{2}{5}(m+n)+2\).

Finally, we add blocks in the corners of \(G_{n,m}\) if these squares are not reachable by the robot:

  • if there is a block on \((2,m-1)\), then we add the block (1, m);

  • if there is a block on \((n-1,2)\), then we add the block (n, 1);

  • if there is a block on \((n-1,m-1)\), then we add the block (nm).

These blocks form the set \(B_3\). Note that at most two blocks are added in \(B_3\), since (1, m) is added if and only if \(m \equiv 0\bmod 5\), and (n, 1) is added if and only if \(n \equiv 2\bmod 5\).

The set of blocks \(B=B_1 \cup B_2 \cup B_3\) form a solution of ice slide \(_{B}^{S}\), of cardinality at most \(\gamma (G_{n-2,m-2}) +\frac{18}{25}(m+n)+\frac{28}{5}\). \(\square \)

By combining the lower and upper bounds and since \(\gamma (G_{n,m})=\left\lfloor \frac{(n+2)(m+2)}{5}\right\rfloor -4\) (Gonçalves et al. 2011), we obtain an asymptotic value for \(\iota \sigma _{B}^{S}(G_{n,m})\):

Corollary 23

If m and n are large enough, \(\iota \sigma _{B}^{S}(G_{n,m})=\frac{mn}{5}+O(m+n)\).

Notice that the construction of Proposition 22 is optimal for \(n=m=2\), \(n=m=3\), and \(m=n=4\). We did not try to find the exact value of \(\iota \sigma _{B}^{S}(G_{n,m})\) in the general case since we think that such a result does not deserve much interest compared to the tedious case study it would need to be proven.

Remark 24

Remark that, in the torus, using an optimal dominating set we immediately get \(\iota \sigma _{B}^{S}(T_{n,m})=\frac{nm}{5}\) when \(n \equiv 0\bmod 5\) and \(m \equiv 0\bmod 5\). Similarly, in the general case, one could also show that \(\iota \sigma _{B}^{S}(T_{n,m}) = \frac{nm}{5} + O(m+n)\).

4.2 ice slide \(_{W}^{P}\)

In what follows, we consider the game ice slide played with walls on a grid and where the robot has to pass over each square. Unlike blocks, there will be two types of walls: horizontal and vertical ones (see Fig. 3).

Definition 25

Let W be a set of walls. The row \(R_i\), \(2\le i\le n-1\) (resp. column \(C_j\), \(2\le j\le m-1\)) is said to be covered by W if there is at least one horizontal wall of W adjacent to row \(R_{i}\) (resp. one vertical wall adjacent to column \(C_{i}\)).

By similar considerations to Sect. 3.1, we get the following observation (recall that \(\rho \) has been defined in Definition 6):

Observation 26

If W is a set of walls in \(G_{n,m}\) which covers every column \(C_j\), \(2\le j\le m-1\), then \(|W|\ge \rho (P_{m-2})\).

This result leads to the following lower bound for \(\iota \sigma _{W}^{P}(G_{n,m})\):

Proposition 27

For each \(n\ge m\), we have \(\iota \sigma _{W}^{P}(G_{n,m})\ge \rho (P_{m-2})\).

Proof

Similar to the one of Proposition 9. If every column is covered by a wall, then the proposition holds from Observation 26. Now consider an optimal solution W such that there exists a column \(C_j\), \(2\le j\le m-1\) which is not covered by a wall. The robot cannot move vertically in \(C_j\) since there is no vertical wall adjacent to this column. Hence it has to go horizontally through every row \(R_i\), \(2\le i\le n-1\), implying that each such row must be covered by a wall. Therefore we get the desired result:

$$\begin{aligned} |W|\ge \rho (P_{n-2}) \ge \rho (P_{m-2}). \end{aligned}$$

\(\square \)

The following lemma is the key to reach the lower bound of the above proposition:

Lemma 28

Assume that the pattern \(P_n\) of size \(n\times 4\) depicted on Fig. 16 is in position (1, j) ((1, j) being the top-left square of the pattern). Then, if a robot is able to enter horizontally in (1, j), it can pass vertically through all the columns \(C_j\) to \(C_{j+2}\). In addition, if a robot enters horizontally the pattern \(P_n\) in position (1, j), it can leave it horizontally on rows \(R_1\) heading right and \(R_{n}\) heading left.

A proof of this result is given by Fig. 16.

Fig. 16
figure 16

Pattern of size \(n\times 4\) for ice slide \(_{W}^{P}\) on grid

Theorem 29

For any \(n\ge m\ge 4\), we have \(\iota \sigma _{W}^{P}(G_{n,m})=\rho (P_{m-2})\).

For \(m=3\) and \(n\ge m\), we have \(\iota \sigma _{W}^{P}(G_{n,m})=1\).

For \(m\le 2\) and \(n\ge m\), we have \(\iota \sigma _{W}^{P}(G_{n,m})=0\).

Proof

Let \(n\ge m\ge 4\). A solution is built by gluing \(\lceil \frac{m-2}{4}\rceil \) copies of \(P_n\) starting from column \(C_2\) and ending in \(C_{m-1}\) (leaving columns \(C_1\) and \(C_m\) empty). In this process, if \((m-2)\not \equiv 0\pmod 4\), then remove the \((m-2)\pmod 4\) last columns of the rightmost copy of \(P_n\). Figure 16 ensures that all the columns (except the last ones) of all the copies are visited by entering from row \(R_1\). It also shows that all the rightmost columns of each pattern can be visited by entering from the right on row \(R_n\). Note that it is also true for the rightmost copy of \(P_n\) since the robot can move vertically in column \(C_m\).

In the case where \(m=3\), it is straightforward to see that from position (1, 1), the robot cannot visit all the squares if there is no wall. A vertical wall adjacent to position (1, 2) is however sufficient. \(\square \)

Remark 30

Note that Theorem 29 remains valid for any starting position. It is not hard to see that the pattern of Fig. 16 ensures the robot to reach (1, 1) from any position.

4.3 ice slide \(_{W}^{S}\)

In what follows, we consider the game ice slide played with walls on a grid where the robot has to stop on each square. Constructions and proofs are similar to the ones of Subsection 4.1. We obtain the following lower bound for \(\iota \sigma _{W}^{S}(G_{n,m})\):

Proposition 31

For each \(n\ge m \ge 3\), we have \(\iota \sigma _{W}^{S}(G_{n,m})\ge \rho (G_{n-2,m-2}).\)

Proof

Consider an optimal solution W of ice slide \(_{W}^{S}\) on \(G_{n,m}\). Let (ij) be an inner square of the grid, i.e \(2\le i \le n-1\) and \(2\le j\le m-1\). There must a wall adjacent to (ij) otherwise the robot cannot stop on it. Let \(G'\) be the grid induced by the inner squares. It is isomorphic to \(G_{n-2,m-2}\). Let \(W_1\) be the set of walls that are adjacent to two inner squares of \(G_{n,m}\). Let \(V_b\) be the set of squares of \(G'\) that are not adjacent to a wall of \(W_1\). Note that all these squares are on the border of \(G'\) and for each square of \(V_b\), there is a wall between this square and the adjacent square on the border of \(G_{n,m}\). Hence one can add to \(W_1\) one wall adjacent to each square of \(V_b\) and this new set \(W'\) will have size at most |W|. The set \(W'\) naturally corresponds to a set of edges of \(G'\) that cover the vertices of \(G'\). Hence we have:

$$\begin{aligned} \iota \sigma _{W}^{S}(G_{n,m})=|W|\ge |W'|\ge \rho (G_{n-2,m-2}). \end{aligned}$$

\(\square \)

We now give a construction of a solution of ice slide \(_{W}^{S}\) on \(G_{n,m}\).

Proposition 32

For any \(n\ge m \ge 3\), we have

$$\begin{aligned} \iota \sigma _{W}^{S}(G_{n,m})\le \rho (G_{n-2,m-2})+\frac{3(m+n)}{4} +3. \end{aligned}$$

Proof

Let \(n\ge m\ge 3\). We construct a solution W of ice slide \(_{W}^{S}\) in three steps. The construction is illustrated on Figs. 17 and 18.

We denote by \((i,j)-(i,j+1)\) the vertical wall between the square (ij) and \((i,j+1)\) and use the same notation for horizontal walls. An inner wall is a wall that is not touching the border (if it is a vertical wall, it means that \(2\le j \le m-2\) and i is not constrained in the previous notation).

Let first \(W_1\) be the set of inner walls that are the translation of the walls \((2,2)-(2,3)\) and \((3,2)-(4,2)\) by linear combinations of the three vectors \(\{(1,1), (0,4), (4,0)\}\) (see the inner walls of Fig. 17). Note that \(W_1\) covers all the inner squares of \(G_{n,m}\) and that each square is covered exactly once. Some walls of \(W_1\) are located between an inner square and a border square. There are at most \(2\left( \left\lceil \frac{n-2}{4} \right\rceil +\left\lceil \frac{m-2}{4} \right\rceil \right) \le \frac{m+n}{2}+2\) such walls. Hence \(|W_1|\le \rho (G_{n-2,m-2})+\frac{m+n}{4}+1\).

Fig. 17
figure 17

Solution of ice slide \(_{W}^{S}\) on \(G_{9,7}\)

Fig. 18
figure 18

Pattern of the solution of ice slide \(_{W}^{S}\)

The walls of \(W_1\) will be enough to ensure that the robot will stop on almost each inner square as soon as it will enter to some of them. Indeed, if the robot enters in a rectangle of size \(3\times 2\) that has four walls on its border (see as an example the gray rectangle on Fig. 17), then it will be able to stop in the four corners of this rectangle and thus to go out of the rectangle from these four places (see Fig. 18). To ensure that the robot will enter in the rectangles of the border of the grid and stop on the border, we add some walls that will form the set \(W_2\). For each wall of \(W_1\) located between an inner square and a border square, we add a wall in \(W_2\) in the following way:

  • for each \((1,j)-(2,j)\in W_1\), we add the wall \((1,j)-(1,j+1)\) to \(W_2\);

  • for each \((n-1,j)-(n,j)\in W_1\), we add the wall \((n,j-1)-(n,j)\) to \(W_2\);

  • for each \((i,1)-(i,2)\in W_1\), we add the wall \((i,1)-(i+1,1)\) to \(W_2\);

  • for each \((i,m-1)-(i,m)\in W_1\), we add the wall \((i-1,m)-(i,m)\) to \(W_2\).

We furthermore add the wall \((2,1)-(3,1)\) to \(W_2\). Finally, if \((n-2,m-1)-(n-1,m-1)\) (respectively \((n-1,m-2)-(n-1,m-1)\)) is a wall, we add the wall \((n,m-2)-(n,m-1)\) (resp. \((n-2,m)-(n-1,m)\)) to \(W_2\). Note that the first case holds if and only if \(n-m\equiv 2\bmod 4\) and whereas the second case holds if and only if \(n-m\equiv 3\bmod 4\).

The final set of walls \(W_1\cup W_2\) is a solution of ice slide \(_{W}^{S}\) of size at most

$$\begin{aligned} \rho (G_{n-2,m-2})+\frac{3(m+n)}{4}+3. \end{aligned}$$

\(\square \)

By combining the lower and upper bounds and noticing that \(\rho (G_{n,m})=\left\lceil \frac{nm}{2}\right\rceil \), we obtain an asymptotic value for \(\iota \sigma _{W}^{S}(G_{n,m})\):

Corollary 33

If m and n are large enough, \(\iota \sigma _{W}^{S}(G_{n,m})=\frac{mn}{2}+O(m+n)\).

As for Sect. 4.1, we did not try to find the exact value of \(\iota \sigma _{W}^{S}(G_{n,m})\).

Remark 34

The solution built in Proposition 32 remains valid for any starting position except the part of the border around the bottom-right corner when \(n-m\equiv 0 \bmod 4\) or \(n-m\equiv 1 \bmod 4\).

5 Conclusion and open problems

As mentioned in the introduction, the literature about sliding/pushing games is rather wide. From our point of view, the game detailed in the current paper is worth to be studied since it can be directly expressed with well-known graph optimization problems. Although the exact determination of \(\iota \sigma _{}^{}(G_{n,m})\) is the ultimate objective when considering an instance of the game, we managed to compute it only for the case where the robot must pass on each square of a grid. In the case where he must stop everywhere, we saw that the exact value is a bit more tedious to obtain. We thus proposed an upper bound in O(nm).

In addition, ice slide can naturally be declined under several variants that fit some constraints of other related games. Here is a non-exhaustive list of variants that could be considered:

  • The presence of other robots is also a parameter that could be adjoined to our problem, as it is the case in the original game Rasende roboter (which admits three other robots). These additional robots are only used to make the main robot bounce on them. As said in the introduction, the only non-trivial instances are ice slide \(_{B/W}^{S}\) with two robots.

  • In the game Rasende roboter, the objective is to find the minimum number of moves of a solution with several robots. This aspect is not considered in our version. It would imply that the blocks/walls are set at the beginning of the game, as well as the starting and final positions of the robot.

  • The configuration of the board can be changed, e.g. subgraphs of the grid, hexagonal grids, or grids without boundary, as it is the case in Lunar lockout.

  • The robot may push blocks, as it is the case in all the variants of pushpush.