Bowling for Dollars

Section: Laboratory Assignment
...Subsection: Bowling for Dollars


Exercise 6

In his spare time, Shakey works as a pin-setter in the local bowling alley. If you load the Bowling world, then Shakey is positioned in the middle of the window, holding ten bowling pins.

Write a program that directs Shakey to place the pins in a triangle shape, where the first row contains one pin, the second row contains two pins, the third row contains three pins, and the forth row contains four pins. The pins on each row are separated by a blank spot.

Design your solution so that is can be easily extended. That is, it should be fairly easy to modify your program if, instead of ten pins, Shakey started with fifteen pins and placed a fifth row of five pins in the triangle.



Suzanne Menzel; menzel@cs.indiana.edu