Let's assume we are guiding a robotic mouse in a two-dimensional maze. The mouse is situated in the upper-left corner of the maze and must reach the lower-right corner. Unfortunately, there is no direct path in the maze between those two corners. However, we can slide the rows and columns of the maze: by sliding a row one cell-length to the right, for example, we move all the cells in that row exactly one cell-length to the right, re-inserting the rightmost cell from the left. By sliding a column we do the same, sliding cells down. If the mouse is in the row/colum, it will be moved along with its cell.
We proceed in turns: In each turn, we can guide the robotic mouse into any cell reachable from its current cell. Between each two consecutive turns we slide one row or column. Our goal is to minimize the number of turns it takes the mouse to reach its goal.
We represent a maze by a hexadecimal string in the following manner: First, each cell in the maze is represented by a 4-digit binary string representing which passages are blocked (0) and which are open (1) for the directions "up", "right", "down", and "left", in that order. Every such 4-digit string can be converted to a single hexadecimal digit; this correspondence can be seen in the following illustration:
An nxm maze can be represented by a hexadecimal string of length n\cdot m where the first m digits give the upper row, the next m digits give the second row, and so forth. For example, the string:
represents the following maze:
We denote cells in the maze by (a,b), where a is the row number and b is the column number, both starting from 0. For example, if the mouse is in the second row from the top and the third column from the left, its location is (1,2). The mouse starts from (0,0) and for a nxm maze needs to reach (n-1, m-1).
Your goal: Given the 7x7 maze:
Find a sequence of moves for the mouse and row/column slides such that the mouse reaches the exit in at most 6 turns.
An example of the format for the move list:
[(3,5), "C2", (6,3), "R0", (7,7)]
Where each pair (a,b) means "move the mouse to the square (a,b)", the "C2" move means "slide column number 2" and "R0" means "slide row number 0".
A bonus "*" will be given for solving the 10x10 maze:
In at most 14 moves.
We will post the names of those who submit a correct, original solution! If you don't want your name posted then please include such a statement in your submission!
We invite visitors to our website to submit an elegant solution. Send your submission to the email@example.com.
If you have any problems you think we might enjoy, please send them in. All replies should be sent to:firstname.lastname@example.org
03/10/2021 @ 12:00 PM EST Solution:
04/11/2021 @ 12:00 PM EST List Updated:
13/10/2021 @ 12:00 PM EST
People who answered correctly:
Lorenz Reichel (4/10/2021 10:00 AM IDT) Daniel Chong Jyh Tar (4/10/2021 10:36 AM IDT) Paul Revenant (4/10/2021 1:13 PM IDT) *Guillaume Escamocher (4/10/2021 3:56 PM IDT) John Goh (4/10/2021 6:37 PM IDT) *Lazar Ilic (4/10/2021 8:46 PM IDT) *Phil Proudman (4/10/2021 9:07 PM IDT) Marcel Caria (4/10/2021 10:42 PM IDT) Kamil Jarosz (5/10/2021 12:08 AM IDT) *Bertram Felgenhauer (5/10/2021 5:57 AM IDT) Amos Guler (5/10/2021 2:56 PM IDT) Nzube Ntube (5/10/2021 5:05 PM IDT) Reiner Martin (6/10/2021 2:15 AM IDT) *Aviv Nisgav (6/10/2021 10:11 PM IDT) *Yuval Yevnin (7/10/2021 11:45 AM IDT) *Vladimir Volevich (7/10/2021 7:48 PM IDT) *Andreas Stiller (8/10/2021 4:25 PM IDT) Ralf Jonas (8/10/2021 10:35 PM IDT) *Dieter Beckerle (9/10/2021 12:13 AM IDT) *Andy Greig (9/10/2021 2:48 PM IDT) Graham Hemsley (9/10/2021 5:59 PM IDT) *Dominik Reichl (9/10/2021 9:21 PM IDT) *Gary M. Gerken (9/10/2021 9:43 PM IDT) *Tim Walters (11/10/2021 1:49 AM IDT) Stefan Wirth (11/10/2021 3:37 PM IDT) *Latchezar Christov (12/10/2021 5:59 PM IDT) *Sean Egan (13/10/2021 7:49 AM IDT) *Daniel Bitin (13/10/2021 1:02 PM IDT)