Devil and the Hero on the Chessboard

The hero (lower right) and devil (upper left) each take turns moving on the grid with the hero going first. Both move as a King piece would on a chessboard. The devil wins if he can move to the same space as the hero. The hero wins if he can avoid the devil forever.

The devil can always win on a 3 x 3 board.

Who will win on an 8 x 8 board?

The hero The devil

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

11 solutions

Given that the devil will always win in a 3x3 board (which can be inferred very easily), let us consider a 4x4 board. Whatever be the first move of the hero, the devil can take its first move in such a way that the devil and the hero are now in a 3x3 grid and hence the devil will win.

Similarly it can be seen with any of the NxN boards where the problem would reduce to N-1 x N-1 boards and eventually to a 3x3 board and hence the devil would always win. This can be proved inductively.

Nice observation.

Here are some followup exercises:

  • Can the Devil win in any N by M chessboard?
  • If the game were generalized as a game on an arbitrary graph, does the Devil still always win?

Agnishom Chattopadhyay - 3 years, 2 months ago

Log in to reply

  • yes.
Assume N >= M (without loss of generality, since if it was less we could just rename the variables).

After one turn the board they devil can force the hero into a (N-1) by (M-1) safe zone and so on until the board is 1 x (M-N+1) in shape. The devil can then just chase the hero down the row and always win.

  • no.

Consider a 3x3 grid with the middle square missing. On this loop, the devil’s moves cannot reduce the playable area of the hero who could always choose a path to escape the devil.

  • Followup:

On an arbitrary graph WITHOUT islands (an example of an island being the middle square in the example above), can the devil always win?

Phillip Temple - 3 years, 2 months ago

Log in to reply

So, as it turns out, this game is known as the game of cops and robbers , and has been well studied

Agnishom Chattopadhyay - 3 years, 2 months ago

Log in to reply

@Agnishom Chattopadhyay Thanks for the video... Insightful!

Ramasamy Pullappan - 3 years, 2 months ago

Consider a 3x3 grid with the middle square missing. On this loop, the devil’s moves cannot reduce the playable area of the hero who could always choose a path to escape the devil.

Are you certain?

Peter Byers - 3 years, 2 months ago

P.S. For a 3x3 grid with the middle square missing, the devil wins if the hero goes first (assuming they are in opposite corners, as in the original problem). I can also think of a board with an loop such that the devil will wins whether he goes first or not.

Peter Byers - 3 years, 2 months ago

Yes!! My first reaction was trying induction on n. And you are right, since the hero moves first the devil can transpose the problem into a smaller and smaller board.

Another question pops to mind, what is the maximum number of moves that the hero can sustain himself?

M. Zeidan - 3 years, 2 months ago

I don't see how the induction works, because there is a difference between a real 3x3 and a 3x3 subsection of a 4x4 : the hero can get out of the subsection. The hero can't really do anything to delay the capture but this isn't a real proof.

Vincent Aubry - 3 years, 2 months ago

Log in to reply

I agree. The author should clarify why the hero cannot get out of the subsection.

Agnishom Chattopadhyay - 3 years, 2 months ago

Log in to reply

If the hero tries to get out of the subsection, the devil can always make a move in the same direction going back to the layout in the previous move. Since the board is finite, this process has to stop at some point, when the hero's side of the subsection is bounded by the edge of the board. At this point the hero can't get out of the subsection anymore and the situation is equal to the lower size case.

If the board was infinite, the induction would indeed break down as you suggest and the hero could avoid the devil indefinitely - by simply running away = leaving the subsection indefinitely.

Petr Doležal - 3 years, 2 months ago

This really needs more. Part of the reason the devil wins on the 3x3 board is because the hero cannot leave it. This doesn't work as an induction proof. Seems simpler to just prove it directly.

Richard Desper - 3 years, 2 months ago

Log in to reply

This really needs more. Part of the reason the devil wins on the 3x3 board is because the hero cannot leave it. This doesn't work as an induction proof.

Agreed.

Peter Byers - 3 years, 2 months ago

The King piece never moves into check. Ergo, Hero wins.

Bradley Archer - 3 years, 2 months ago
Binky Mh
Apr 1, 2018

The human is 14 (straight-adjacent) tiles away from the devil.

If the human is on the wall, he can at best increase the distance by 1 in a round, but the devil will always be able to decrease the distance by 2 (by moving diagonally). This means if the human stays on the wall, the devil wins. If he moves away from the wall, he decreases the distance, and cannot re-increase this distance as the devil will at least maintain the same speed as the human.

If the human is away from the wall, he can either: travel directly away from the devil to maintain his distance, or the devil will be able to decrease the distance faster than the human increases it. every time he moves directly away, he moves closer to a wall, meaning he will become trapped as stated before.

John Ross
Apr 2, 2018

The dragon needs to move to the right until the hero is directly below the dragon. This is guaranteed to happen either after the dragon's or the hero's move. Then the dragon should move down each move (or down diagonally to match the hero's horizontal moves) until it reaches the hero.

I would replace "needs to" with "can" but otherwise this is my thinking.

Richard Desper - 3 years, 2 months ago

Actually, the dragon's optimal move is to move diagonally toward the hero if possible, then only move straight to the hero if the hero is is the same row or column the dragon is in. Then the dragon wins after it's seventh move (or sooner) regardless of how the hero moves. This can easily be demonstrated by playing out the game multiple times.

To explain the logic: At the beginning of the game, the hero and dragon are at the maximum theoretical distance away from each other. Binky MH made a reference to 'straight adjacent moves' so I'll define that as a 'Binky'. A binky is a unit of travel of one space either horizontally or vertically. At the beginning of the game, the two pieces are the maximum possible distance apart on an 8 by 8 board, or 14 binkies distant. On it's turn, the dragon moves either 2 binkies closer (by moving directly) or 1 binky (by moving straight). Since diagonal travel bring the dragon closer to the hero faster then straight travel, the dragon will try to maximize diagonal movement.

Gordon Parks - 3 years, 2 months ago
Everett Thiele
Apr 8, 2018

Win by smothering.

On any finite chessboard, with any starting positions of the hero and devil:

(1) If the devil ever shares a column or row with the hero, the devil can force a win.

(2) The devil can always move to where it shares a column or row with the hero.

By (1) and (2): the devil can force a win.

Proof of (1). Let us just take the row case. (The column case holds by symmetry.) The devil and hero share a row and it is the hero’s turn. Define "rank" as the shortest distance measured in squares from the devil's column to the hero's column. By the rules for movement, barring edge constraints, the hero can change rank by -1, 0, or 1. At the same time the hero can also change to an adjacent row (either by moving diagonally, in connection with changing the rank; or by moving sideways [in relation to the hero/devil axis] when not changing the rank). After any of these possible moves the Devil can always reduce the rank by 1 and restore (if necessary) row alignment with the hero. So row alignment is restored with either the same or lower rank distance. The hero cannot however continue increasing rank indefinitely (backing away) becase s/he will reach a board edge. From this point on, after every move by the hero, the devil can play such that rank will decrement by one and the devil will win.

Proof of (2) Just taking the row case, define "alignment offset" as the distance between the devil's row and the hero's row. By the rules for movement, when the devil moves it can always reduce the alignment offset by 1 (with or without an accompanying diagonal component in the move, for the sake of optimization for example). The hero can change the alignment offset by -1,0,1 but is similarly bounded by an edge, as described in proof of (1). When the hero no longer can evade sideways, the devil will be able to reduce the alignment offset to zero, i.e. enter the same row as the hero.

Indeed. Essentially, the devil first moves towards the hero's row until he reaches the same row. Thereafter, he applies the same strategy to reach the same column as the hero, while at the same time moving up/down as necessary to remain in the same row.

Stewart Gordon - 3 years, 2 months ago
Attila Kiss
Apr 4, 2018

The devil can reach the same or adjacent row of the hero. Then it moves always to the same row while closing the columns.

Pranav Rao
Apr 5, 2018

Lets now start with the time when the devil and the hero are in a straight line and its hero's turn to move.Also without loss of generalization the hero is above the devil in the same column(otherwise you can rotate the board and proceed with the following arguments).

  1. Now at maximum the number of moves the hero can make is 8 . Call them N, NE, E, SE, S, SW, W, NW (based on the directions).
  2. If the hero moves E or W, the devil moves NE or NW resp.
  3. If the hero moves SE S or SW then devil moves NE, N or NE resp.
  4. If the hero moves NE, N or NW, then the devil copies the moves of the hero.

Now we can see that the devil will always be in the same column as the hero and also the vertical distance them must be same or reduce.The distance will be same if and only is the hero moves as case 4. But then he can make only finite many moves as case 4 and hence the devil will meet the hero.

We now need to prove that the devil can always reach the same column as the hero. This is easy to prove as the devil can keep on going right till he is in the same column as the hero. If the devil by chance is in the same column as the hero and it's his turn, then he can move in the same column to reduce the problem to above case

The devil will always win. The devil just needs to move toward the hero, and at some point the devil will be able to move directly in front of the hero. Then, the hero will be forced to move away from the devil. Regardless of the move the hero takes from the three possible moves to get away from the devil, the devil will be able to take the previous position again, forcing the hero to move back again. Eventually, the hero will reach an edge of the board and the hero is trapped!

If devil wins in a 3x3 then it always win in square

Greg Whiteside
Apr 3, 2018

In the first move, the hero moves to a black square. Then the devil moves to a black square. For every size NxN board, the devil will win. The only way the hero can win is if he starts on a different color square than the devil. This happens on an NxM board where either N or M is even and the other is odd.

I'm pretty sure the Devil wins in any NxM board. No matter which squares you start them in. You can even try it out in a chessboard by covering 1 line to make it 7x8

Komninos Maraslidis - 3 years, 2 months ago

Log in to reply

You are correct. I forgot about diagonal moves.

Greg Whiteside - 3 years, 2 months ago
Max Patrick
Apr 3, 2018

The absolute distance (by Pythagoras if need be) between Devil and Hero, can often decrease but NEVER has to increase. Therefore the Devil will steadily approach the Hero.

Hamza Ijaz
Apr 2, 2018

The simple answer for this is the hero only win if he avoids the devil forever which means the game will continue forever and sometime the devil must be able to catch him

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...