Lab: Black Box Challenge

A 1978 Parker Brothers board game called "Black Box" involved locating deflecting baffles within the black box. The box can be represented by a 10 x 10 character array.

Ten mirrors, denoted by '/' or '\' are placed randomly on the board. Two of them are shown at (1, 15) and (4,15). We will refer to them by the (bottom, left) coordinates.

The numbers around the perimeter of the box represent lasers that shoot into the box. When you shoot the laser it will emerge at some other numbered position. For example, if laser 24 is shot it will emerge at position 21, having been deflected by both shown baffles. In like manner, laser 4 will come out at 34.

      20212223242526272829
   19 . . . . . . . . . . 30
   18 . . . . . . . . . . 31
   17 . . . . . . . . . . 32
   16 . . . . . . . . . . 33
   15 . \ . . / . . . . . 34
   14 . . . . . . . . . . 35
   13 . . . . . . . . . . 36
   12 . . . . . . . . . . 37
   11 . . . . . . . . . . 38
   10 . . . . . . . . . . 39
      0 1 2 3 4 5 6 7 8 9

There are three options.
   Choose:
      (1) Shoot a Laser
      (2) Guess at a mirror location
      (0) Quit the game
   Enter choice: XX

If a mirror location is guessed correctly, it is then shown. The object is to find all 10 mirrors with the fewest number of incorrect guesses and shots.

Your program should keep tract of shots and guesses (correct and incorrect).


Continue to:  Unit 4  / Prev  / Next