BYU logo Computer Science

To start this lab, download this zip file.

Project 1 - Bit

invert.py

Invert the entire world. Blue becomes empty, empty becomes blue.

triple.py

For this problem, bit starts facing the left side of the world next to a “rectangle” made of 1 or more blocks. The goal is to put green blocks on the first three sides it encounters.

First bit does one “side” move, moving forward while there are blocks to the left, painting squares green. There’s a boundary detail here: paint the squares next to a block green, but not the last square.

Before the side move:

After the side move:

Then, turn left and do another side move. Then do the third side. That completes one rectangle, which looks like this:

The overall “triple” problem is just 3 rectangles put together, with a right turn making the transition to the 2nd and 3rd rectangles.

It starts like this:

And should finish like this:

blue_s.py

Move Bit to the right edge of the grid.

If Bit encounters a green square, draw a blue “S”.

The bends in the “S” are marked by blocked squares.


red_blue.py

Paint the left side of the world with red and the right side blue. Put a green square in between.

Return Bit to the bottom-left corner when finished.

Grading

ActivityPoints
invert.py25 points
triple.py25 points
blue_s.py25 points
red_blue.py25 points