BYU logo Computer Science

To start this assignment, download this zip file.

The following guide pages cover material needed for this assignment:

New Colors

Bit can now paint some new colors! There are too many to keep track of, so you won’t use them directly. Instead, you’ll do something like the following:

color = bit.get_color()
paint_column(bit, color)

Homework 2d — Variables

1. Color bars

For this problem, Bit wants to make bars of color. For this starting world:

The bottom row has a variety of colored squares. Bit starts on the left, in the bottom row.

the ending world should look like this:

Each colored square is now a painted column of that color. Bit ending on the right, in the bottom row.

There is a second world:

The bottom row has red squares seperated by white sqaures, and the top left has a black row above which are blue squares. Bit starts in the bottom left.

that Bit should turn into this:

The red squares are turned into red columns, bit ends in the bottom right.

The starter code is in color_bars.py.

2. Wells and vines

For this problem, Bit wants to grow vines and fill wells. However, Bit doesn’t know what color the wells or vines should be until reaching a colored square. Bit lives in this world:

a path with colored squares in the same row as bit, and each colored square has an empty space either above or below it. Bit starts on the left.

Bit’s job is to grow each vine and fill each well:

The empty space either above or below the colored squares has been painted that color, bit ending on the right

There is a second world that looks like this:

a path with colored squares in the same row as bit, and each colored square has an empty space either above or below it. Bit starts on the left.

When bit is done, the world will look like this:

The empty space either above or below the colored squares has been painted that color, bit ending on the right

The starter code is in wells_and_vines_.py.

3. More lines

Bit starts in a world with some incomplete lines in each row:

incomplete lines in each row, with the first and last square colored. Bit starts in the bottom left.

Bit should fill all of the lines in each row:

all lines are complete in each row, with the white squares in between colored squares being painted that color. Bit ends in the bottom left.

There is a second world:

incomplete lines in each row, with the first and last square colored. Bit starts in the bottom left.

That Bit should turn into this:

all lines are complete in each row, with the white squares in between colored squares being painted that color. Bit ends in the bottom left.

The starter code is in more_lines.py.

Grading

ActivityPoints
color_bars.py4
wells_and_vines.py8
more_lines.py8

Manual Grading

Refer to the Quality Code guide page for detailed explanations and examples on each of these rubric criteria.

Intent

The intent of this assignment is for you to start to use variables, and that you write code that solves worlds of any size.

When a function has an additional argument (like color), it should use that argument somewhere within the function.

Make sure to follow the maximum indentation rule.

RubricPoints
Whitespace1
Naming1
Decomposition4
Intent4
Total10