Dr. Evil has contracted your valuable services to build for him the world's most powerful "laser". Of course before you spend one billion dollars
building the thing, you want to run some simulations first to make sure everything will work as designed. For this phase of the project, you will be
simulating part of the aiming system which uses mirrors and other optics to change the direction of the laser beam.
The simulation consists of a flat square table with mirrors, beam splitters, and beam detectors arranged on the tabletop, and with each object
represented by a one dimensional line segment. The list below describes each of the object types in detail:
mirror : A mirror object will reflect any laser beam striking its surface. The reflected beam leaves at the same angle of incidence as the
incoming beam. Note that both sides of a mirror object are reflective.
detector : A detector is an opaque object which absorbs any laser beam striking it. The simulation must also keep track of which detectors are
struck by a laser for program output purposes. Note that a laser beam strike on either side of a detector counts as a "hit".
splitter : When a laser beam strikes a splitter, it divides into two beams. One of the new beams will reflect from the splitter surface (as with a
mirror), and the other beam will pass through the splitter without changing direction. A splitter will function the same way regardless which
side of it is struck by a laser beam.
See the figures below for examples of a laser beam's interaction with each of the possible object types:
For each simulation, a single laser beam enters the tabletop area. The program must compute the path taken by the laser beam (including secondary beams due to splitters), and it must determine which detectors are struck by a laser beam.
You can make the following assumptions in the program:
1. The tabletop surface is a 100 by 100 square, and unless otherwise specified all coordinates in the program's input are given as integers within
the tabletop area (i.e. between 0 and 100 inclusive).
2. There will be no overlaps between the line 2. segment objects.
3. The laser which enters the tabletop area always starts from the edge of the table.
4. The simulation of each data set ends when all laser beams have either exited the table top area or have terminated at a detector.
5. For each data set there will be no more than 100 total reflections among all laser beams in that data set.
6. A laser beam will never intersect any object on a vertex and will never be collinear with an object's line segment.
7. Each data set will contain at least one detector object.