Home About Me Photos Computer Science Humanities Language Math Modeling Physics STEM I STEM II

Computer Science - Mrs. Taricco

In Computer Science, we are learning how to write and analyze computer programs. The main programming language we're using in class is java, although we also used CSS and HTML to code our websites.

Here's some of the programs I've completed in this class:

Program 1: Bulgarian Solitaire

This program was designed to mimic the game of Bulgarian Solitaire, in which a random number of piles are created with a random number of cards in each pile. Each round, one card is removed from each pile, and these cards are then used to make a new pile. This process is then repeated until there is a pile with 1 card, one with 2 cards, one with 3 cards, etc.

Trouble viewing this doc? Click here.

First, the number of cards entered by the user had to be checked to make sure it was a triangular number. A triangular number is a number that can evenly be split up into a sequence of numbers starting at 1 (for example, 6 can be split into 1, 2, and 3). After there were two parts to coding this game. I had to recreate the gameplay described above, and also create a procedure that would generate a random number of piles with a random number of cards in each (the piles had to contain the same number of cards that the user entered). Surprisingly, it was easier to recreate the gameplay itself using hard-coded values. However, I went back after and coded a procedure that would generate the piles of cards, and then applied that to the part of the program that recreated the gameplay.

Program 2: Line Art optical illusion

This program draws an optical illusion that appears to be made out of arcs. However upon further inspection, you can see that the illusion is actually made up of a bunch of lines. This is the code that I used to create this illusion.

Trouble viewing this doc? Click here.

In the above code, each corner of the illusion is created using its own for loop. Scroll down to check out a picture of what the final product looks like!

This is the line art optical illusion that this code creates