12
$\begingroup$

You are given an empty 4x4 grid. You can place some diagonal mirrors into the cells of the grid. You then fire a laser from some location outside of the grid. The laser travels in a straight line. When it hits a mirror it bounces off at a right angle and spins the mirror by 90 degrees. The same mirror can be hit and spun multiple times.

Consider the following example. We place 4 mirrors in the centre of the grid and fire the laser below the second column. It hits the mirrors like so:

enter image description here

The mirrors spin around and the laser continues hitting another 2 mirrors before exiting the grid. In total it had 6 mirror hits:

enter image description here

What is the most number of mirror hits you can obtain on a 4x4 grid?

$\endgroup$
9
  • $\begingroup$ Do the mirrors spin instantaneously? eg. Would there be a sliver of laser reflecting upwards from the top-left mirror and to the right of the top-right mirror? $\endgroup$ Nov 30 '21 at 2:36
  • $\begingroup$ First the laser bounces then the mirror spins. So it is not instant. $\endgroup$ Nov 30 '21 at 2:57
  • $\begingroup$ Note in the final configuration, the bottom two mirrors will be in their starting orientation. $\endgroup$ Nov 30 '21 at 2:59
  • 2
    $\begingroup$ Isn't this just Langton's ants with possible empty cells. $\endgroup$
    – WhatsUp
    Nov 30 '21 at 9:12
  • 1
    $\begingroup$ @WhatsUp Not quite Langton's ants. In this, turning right or left also depends on where the ant is coming from. $\endgroup$ Dec 10 '21 at 0:21
12
$\begingroup$

Proving a solution to be optimal will require programmatically checking all possible mirror placements, let's go ahead and do that.

The results are in, and the winner is:

This layout, which scores 49 hits!
Mirror grid

This optimal solution is essentially unique. Aside from reflections and rotations, the only other optimal solution is the inverse, which follows the same path in reverse and has as it's initial position the final position of the above solution with all mirrors rotated.

$\endgroup$
34
  • 7
    $\begingroup$ @DmitryKamenetsky An infinite loop is impossible on any finite grid. Every mirror involved in the loop will be hit an infinite number of times. Consider the left-most column containing such mirrors, and then the top-most mirror in that column. That mirror will deflect the laser to the top or left in one of its orientations, sending the laser out into space and breaking the loop. $\endgroup$ Nov 30 '21 at 10:09
  • 1
    $\begingroup$ @RossPresser My argument holds for all four corners, so you need at least four. You could of course have them arranged on the corners of a rectangle, with the laser going looping around in that rectangle. There is however no way to set it up without the laser gun being in the way, even with additional spinning mirrors. The reason is that everything is time-reversible. If you film it going through one of the loops, you could play that backwards repeatedly and it would still be a valid looped path. That path loops, so could never go back to the laser gun that supposedly started it. $\endgroup$ Nov 30 '21 at 15:53
  • 1
    $\begingroup$ @Stef No, that will take a bit more effort. I could probably create an animation in Blender, but that may take a while as I have no prior experience with the software. $\endgroup$ Nov 30 '21 at 16:47
  • 2
    $\begingroup$ @FirstName 4x4 has just over 43 million possible grids. 5x5 has nearly 20 thousand times as many. Run time for 4x4 is under a minute. For 5x5, could be over a week. $\endgroup$ Nov 30 '21 at 21:44
  • 2
    $\begingroup$ @FirstName Easy enough. Optimal solution for 3x3 has 18 hits. With the added condition that all cells must contain a mirror, optimal solutions have 17, 46, and 85 hits. Allowing exactly one vacant cell limits the search space enough that 5x5 is still feasible (~450 million grids). In that case optimal solutions have 18, 49, and 102 hits. $\endgroup$ Dec 1 '21 at 0:03
3
$\begingroup$

This is not an answer but here is an animation showing Daniel Mathias's answer.

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ I love this! Thank you for making it. $\endgroup$ Dec 2 '21 at 23:46

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.