CS 112 - Introduction to Computer Science II
Homework #1 |

1. **Bash: **Have you already learned the
basics of the bash shell as represented in our
tutorial?

- Yes: Consult online documentation, learn three new things about the bash shell, and describe them briefly. Include these descriptions in your README file.
- No: Do the bash tutorial ("Getting started with bash at Gettysburg"). Do the tutorial in one sitting so that you'll be able to submit a transcript of your shell commands. These will be appended to a "README" file which can be submitted via Moodle.

The more you know of your work environment, the more efficient you will be. A little time spent above and beyond these tutorials will likely pay off significantly in the long run as a CS major/minor.

3. **Modular Pascal's Triangle**: Read about
Pascal's Triangle.
For this exercise, you will be computing a 2D array with a Modular Pascal's
Triangle, that is, a Pascal's Triangle formed with
modular addition.
(This will be similar in arrangement to the last Fibonacci pattern figure of
this
Wikipedia article section, with blank areas filled with 0's.) Implement and submit ModularPascalsTriangle.java according to
this specification.

Optionally, here's some fun you can have while testing your program:

- You may visualize the beautiful patterns formed by your code using
ModularPascalsTrianglePlot.java. For modulus 2, you'll see the
Sierpinski
triangle pattern. This needs to be compiled in the same directory
as your ModularPascalsTriangle.java and should be run from the command
prompt as follows: "java ModularPascalsTrianglePlot <size> <mod>" where the
<size> is the number of rows
*and*the number of columns. E.g. "java ModularPascalsTrianglePlot 400 5". Zeros are colored white and from 1 to the modulus minus 1 fades from red to yellow to green to blue. - For any prime modulus, what do you observe about the patterns? Try 2, 3, 5, 7, 11, and 107 for different sizes.
- For these prime modulus plots, what do you observe at the top of each of the white (zero) downward triangles?
- For larger prime modulus plots (e.g. 997, 104729), what do you observe within the non-white (non-zero) regions?
- For simple non-primes (e.g. 6), do you observe any interesting patterns?

**Rubric: (20 points total)**

- 6 points: Bash
- tutorial path:
- all tutorial commands executed and evidenced in the README file output of history command: full credit
- for every 3 tutorial commands missed, -1 point

- learn three new things (not in tutorial):
- for each piece of new bash knowledge described that is
*not in the tutorial*, +2 points (up to 6 points maximum)

- for each piece of new bash knowledge described that is

- tutorial path:
- 4 points: Eclipse (awarded according to attendance records for class 1)
- 10 points: Modular Pascal's Triangle