Burying The Bones

Your program must choose where to bury each line of bones randomly. To do this, it will have to:

  1. Decide (randomly) whether the line of bones should be North-South or East-West. The probability of each of these outcomes should be .5 (50%).
  2. If horizontal, randomly choose the leftmost position of the line so that the line won't be too long for the grid
  3. If vertical, randomly choose the topmost position of the line so that the line won't be too long for the grid
  4. If one of the bones in this line of bones will occupy a grid position that already has a bone, then reject the position of this line, and generate a new position using steps 1,2, and 3.
  5. If none of the bones in this line of bones will occupy a grid position that already has a bone, then accept the position of this line of bones.
  6. Of course, once you accept the position of the line of bones, you'll have to store it somewhere. There are many ways to represent the line of bones. Choose one that is most convenient for you.

Your program must bury four lines of bones of lengths 4,3,3, and 2.