“Our prisoner nearly dug his way out, oh mighty Sultan,” the chief keeper of the prison told the Sultan, “because the rock our prison cells are made of is so soft.”
“Which prisoner are you talking about?” the Sultan asked.
“The one who laid eyes on the eyes of your favorite wife, Oh mighty One,” the chief keeper of the prison replied.
The Sultan moved uneasily when hearing these words, as one of his other wives was in the room.
“What do you suggest?” the Sultan asked.
“The prisoner had started to dig out a tunnel,” he replied. “We have a prison with 9×9 grid of prison cells. If we move him to another cell every day, he will not be able to dig a tunnel.”
“What will you do when he is in the 81th cell?” the Sultan asked.
“Again move him to a new cell, which will be the one in which he is now,” the chief prison keeper replied.
“OK. But don’t spend to much time on him,” the Sultan said. “Always move him just to a cell that is horizontally or vertically adjacent.”
Can the keeper of the prison move the prisoner in such a way that the prisoner is moved to an adjacent cell and visits every cell exactly once, and is moved back to his current cell on the 82nd day?
You can check your solutions here