Transferring 9 pegs on a 9x9 grid

You are given a 9x9 grid with a set of 9 pegs (red circles) arranged in a 3x3 pattern in the corner, as shown below:

A peg can jump over another adjacent peg in any direction (horizontal, vertical or diagonal as shown in blue), provided that the destination cell is empty. A move consists of taking one peg and making one or more consecutive jumps, as shown below:

Can you transfer all the 9 pegs to the opposite corner of the grid, arranged in the same 3x3 pattern?

Bonus question: what is the smallest number of moves you can do it in?

Good luck!

• @Bass that's a good point. I don't think it would be possible to show optimality without a computer. However, I was hoping that people can still do this by hand and get sub-optimal answers. Would that still be ok for a puzzle? Perhaps I need to reword the question somehow? – Dmitry Kamenetsky Oct 3 at 5:59
• Ok I've modified the problem. The primary objective is to complete the puzzle in any number of moves. The bonus question asks for the minimal number of moves. – Dmitry Kamenetsky Oct 3 at 6:15
• Can't I just diagonally shift all pegs in 9×6= 54 moves. – Rishi Oct 3 at 6:48
• @Rishi sorry I don't understand your solution. They need to jump, not shift. – Dmitry Kamenetsky Oct 3 at 7:29
• @Rishi Pegs must always jump over other pegs. – Jaap Scherphuis Oct 3 at 8:16

I was having a slow work day, so I fired up Blender and made this:

In 13 hops, the block of 9 pegs can be moved two places down and to the right. By repeating the process two more times, the pegs can be moved to the bottom right corner.

• ((((worship)))) – Conifers Oct 3 at 16:13
• That is so beautiful! – Dmitry Kamenetsky Oct 3 at 22:01
• If consecutive moves by the same piece count as a single move, you could probably optimize this some. (Looks great though.) – Darrel Hoffman Oct 3 at 23:22
• Upvoted for producing a short film. ;) – Wyck Oct 4 at 2:53
• Brilliant answer! Would you like a bounty award as a gift (after you earn the checkmark, I presume)? :) – Mr Pie Oct 5 at 0:09

It's possible.

Assume the pegs are in the upper left corner of a slightly enlarged chess board, which has indices $$1 - 9$$ and A - I. Now make the moves

b8-d6, c7-e5, d6-f4, e5-g3, f4-h2, g3-i1

b9-d7, c9-c7, c8-e6, c7-e7, d7-f5, e7-e5, e6-g4, e5-c5, f5-h3, g5-g3, g4-i2, g3-i3

a7-c7, a9-a7, a8-c6, c7-c5, a7-c7, b7-d5, c5-e5, c7-c5, c6-e4, e5-e3, c5-e5, d5-f3, e3-g3, e5-e3, e4-g2, g3-g1, e3-g3, f3-h1

EDIT

If I'm counting right, the wonderfully animated solution of @squeamish ossifrage has $$12 \times 3 = 36$$ moves, which is the same number of moves as my solution above. Inspired by the animated solution, I found that I can move the $$9$$ peg block two places down and to the right with just $$9$$ moves:

b8-d6, c7-e5, b9-d7, c9-c7-e7-c5, a7-c7-e7, a9-a7-c7, a8-c6-e6, c8-c6, b7-d5

This reduces the total number of moves to $$9 \times 3 = 27$$ moves. I don't know if this is the minimum, but it's a start.

EDIT 2

Made a computer program to look for a solution with fewer moves. It managed to improve my previous solution so it now only takes

$$23$$ moves

Here they are:

a8-c6, b9-d7, b7-d5, c7-e5, a9-c5, c9-e7, a7-c7, b8-f4, c8-g4, c6-e6, e5-e3, c5-e5, d5-h3, g4-i2, e5-i1, e7-i3, c7-g3, d7-f5, e6-g2, g3-g1, e3-g3, f5-h1, f4-h2

I had to make some assumptions to get a solution within a reasonable time, so I'm not absolutely sure this is the minimum. I'd love to see the minimum if this is not it!

• 27 is very good. It is not the minimum, however it is a great start. Hopefully others can extend your solution. – Dmitry Kamenetsky Oct 5 at 13:01