Welcome to Computer Science!

In Computer Science, taught by Mrs. Taricco, we are studying Java according to the AP Computer Science Applications curriculum. We complete exercises, which teach us the main concepts and methods within each unit, and then we apply our knowledge to creative and interesting labs that involve a bit more work.

Bulgarian Solitaire

One of my most enjoyable assignments that I completed during the year was a program that runs a game called “Bulgarian Solitaire”. In this game, you take a pack of N cards, where N is a triangular number, and divide it into many piles. A triangular number is one that can be formed by adding consecutive positive integers, such as 1, 3, 6, or 10.

Once this initial division is done, a card is removed from each pack and they all get added to a new pile. This process gets repeated until the piles become the list of consecutive positive integers that you originally summed up to get N. The beauty is that this “special” collection of cards will always appear for a triangular number within a certain number of shuffles.

Another very interesting assignment I completed involved line art. This program uses the Graphics class to draw straight lines that connect to the edges of a box and gradually wrap around it. The resulting piece resembles a silk web woven by a spider. Don’t let the seemingly curved appearance of the design fool you! Only straight lines are used to create the artwork.