Problem Description

Your dog is a rather odd dog. She buries the bones you give her in peculiar patterns in the back yard. Specifically, she buries the bones in short lines -- oriented either North-South or East-West (never diagonal), and always buries each of the bones that makes up a line of bones at one of the positions of a grid as in Figure 1:

Figure 1: Your back yard after your dog has been burying bones.
\begin{figure}
\includegraphics {boneyard}\end{figure}

Here she has buried four short lines of bones, one of length four, two of length three, and one of length two. (The length of a line of bones is the number of bones in the line). Notice that she never buries bones on top of one another; the short lines of bones can never cross each other or overlap. Therefore no grid position ever contains more than one bone, and no bone ever belongs to more than one line.

Now, you don't watch your dog bury the bones, so you don't know where they are buried. But you would like to dig them up from time to time so that your backyard doesn't become completely filled with bones. In order to find them, you'll have to guess grid positions until you've found them all.

The goal of this assignment is to simulate the foregoing by writing a Java program. That is, simulate your dog burying four lines of bones of the lengths given above, and allow the user to guess grid positions in order to find the bones. Your program will hide the bones so that the user doesn't know where they are, and after each guess by the user, your program will have to check to see if a bone is buried at that grid position. In addition, your program will print a 'map' showing the user which grid positions haven't been checked yet, which grid positions were checked and found to contain a bone, and which grid positions were checked and found to contain no bone.

If you've ever played the game BattleShip (TM Milton-Bradley) you may recognize the idea for this assignment, although the game described by this handout is somewhat simpler.