# 4.3. Game rules

You have to find balls hidden in the black box. Your means are limited - you can just fire lasers which are around the box. There are three possible outcomes for each ray you send into the box:

- Detour - The ray is deflected and emerges somewhere other than where you sent it in. On the playfield, detours are denoted by matching pairs of numbers - one where the ray went in, and the other where it came out.

- Reflection - The ray is reflected and emerges in the same place it was sent in. On the playfield, reflections are denoted by the letter `R'.

- Hit The ray strikes a ball directly and is absorbed. It does not emerge from the box. On the playfield, hits are denoted by the letter `H'.

The rules for how balls deflect rays are simple and are best shown by example.

As a ray approaches a ball it is deflected ninety degrees. Rays can be deflected multiple times. In the diagrams below, the dashes represent empty box locations and the letter `O' represents a ball. The entrance and exit points of each ray are marked with numbers as described under "Detour" above. Note that the entrance and exit points are always interchangeable. "*" denotes the path taken by the ray.

Note carefully the relative positions of the ball and the ninety degree deflection it causes.

       1            1
       2          - * - - - - - -         - - - - - - - -         - - - - - - - -
       3          - * - - - - - -         - - - - - - - -         - - - - - - - -
       4        1 * * - - - - - -         - - - - - - - -         - O - - - - O -
       5          - - O - - - - -         - - O - - - - -         - - * * * * - -
       6          - - - - - - - -         - - - * * * * * 2     3 * * * - - * - -
       7          - - - - - - - -         - - - * - - - -         - - - O - * - -
       8          - - - - - - - -         - - - * - - - -         - - - - * * - -
       9          - - - - - - - -         - - - * - - - -         - - - - * - O -
      10                                        2                         3

As mentioned above, a reflection occurs when a ray emerges from the same point it was sent in. This can happen in several ways:

       1          - - - - - - - -         - - - - - - - -          - - - - - - - -
       2          - - - - O - - -         - - O - O - - -          - - - - - - - -
       3        R * * * * - - - -         - - - * - - - -          O - - - - - - -
       4          - - - - O - - -         - - - * - - - -        R - - - - - - - -
       5          - - - - - - - -         - - - * - - - -          - - - - - - - -
       6          - - - - - - - -         - - - * - - - -          - - - - - - - -
       7          - - - - - - - -       R * * * * - - - -          - - - - - - - -
       8          - - - - - - - -         - - - - O - - -          - - - - - - - -

In the first example, the ray is deflected downwards by the upper ball, then left by the lower ball, and finally retraces its path to its point of origin. The second example is similar. The third example is a bit anomalous but can be rationalized by realizing the ray never gets a chance to get into the box. Alternatively, the ray can be thought of as being deflected downwards and immediately emerging from the box.

A hit occurs when a ray runs straight into a ball:

       1          - - - - - - - -         - - - - - - - -          - - - - - - - -
       2          - - - - - - - -         - - - - - - - -          - - - - O - - -
       3          - - - - - - - -         - - - - O - - -        H * * * * - - - -
       4          - - - - - - - -       H * * * * O - - -          - - - * - - - -
       5          - - - - - - - -         - - - - O - - -          - - - O - - - -
       6        H * * * O - - - -         - - - - - - - -          - - - - - - - -
       7          - - - - - - - -         - - - - - - - -          - - - - - - - -
       8          - - - - - - - -         - - - - - - - -          - - - - - - - -

Be sure to compare the second example of a hit with the first example of a reflection.