2
$\begingroup$

You are playing a snake game. The snake starts in the top-left corner of a grid. Each cell of the grid is either empty or a wall. Each turn you can press a key to move the snake in one of four directions: either horizontally or vertically. Once a key is pressed, the snake moves in the assigned direction until it either reaches a wall or the boundary of the grid. Can you construct a $6 \times 6$ grid with $2$ walls such that the snake is able to visit every empty cell of the grid?

$\endgroup$
2
$\begingroup$

Put the walls in the 3rd row of the rightmost column and the 4th row of the leftmost column. Then move Right, Down, Left, Down, Right, Down, Left, Up, Right, Up, Left, Down, Right. enter image description here

$\endgroup$
1
  • $\begingroup$ You got it! Well done. Now try my harder version of this puzzle. $\endgroup$ – Dmitry Kamenetsky Apr 16 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.