Skip to content

Commit c46d04c

Browse files
committed
update mirror maze game doc
1 parent 729b1c6 commit c46d04c

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

MirrorMaze/src/MirrorMaze.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,39 @@ or reflect off one side and allow the beam to pass through from the other (1-way
1515
Your challenge is to calculate the exit point of a laser shot into one of the open doors.
1616
You need to provide the room it will be exiting through along with the orientation.
1717
The definition file will be provided through command line parameters.
18+
19+
The Mirrors
20+
There are two types of mirrors that may appear in definition file, 2-way and 1-way.
21+
A 2-way mirror has a reflective surface on both sides. So no matter which side a beam strikes the mirror on, it will reflect off at a 90 degree angle away from the mirror.
22+
A 1-way mirror has a reflective surface on one side. When a laser beam strikes the reflective side of the mirror, it will reflect off at a 90 degree angle away from the mirror. If the laser beam strikes the non-reflective side, it will pass through the room as if the mirror was not there.
23+
24+
The Definition File
25+
The input file will be an ASCII text file with the following format:
26+
The board size
27+
-1
28+
Mirror placements
29+
-1
30+
Laser entry room
31+
-1
32+
Description of each section of the definition file:
33+
• The board size is provided in X,Y coordinates.
34+
• The mirror placement will be in X,Y coordinates indicating which room the mirror is located. It will be followed by an R or L indicating the direction the mirror is leaning (R for Right and L for Left). That will be followed by an R or L indicating the side of the mirror that is reflective if it’s a 1-way mirror (R for Right Side or L for Left Side) or nothing if both sides are reflective and it’s a 2-way mirror.
35+
• The laser entry room is provided in X,Y coordinates followed by an H or V (H for Horizontal or V for Vertical) to indicated the laser orientation.
36+
A Sample Text File
37+
5,4
38+
-1
39+
1,2RR
40+
3,2L
41+
-1
42+
1,0V
43+
-1
44+
45+
Output
46+
At a minimum, your application should print the following to the screen:
47+
1. The dimensions of the board
48+
2. The start position of the laser in the format (X, Y) and the orientation (H or V)
49+
3. The exit point of the laser in the format (X, Y) and the orientation (H or V)
50+
1851
*
1952
*/
2053

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ It includes a collection of fun coding puzzles.
9191
- sumZero
9292
- TreeOps
9393
- TriangleFunc
94-
94+
- MirrorMaze
9595

9696
## License
9797

0 commit comments

Comments
 (0)