BYU logo Computer Science

To start this assignment, download this zip file.

The following guide pages cover material needed for this assignment:

The following link covers essentials of using Bit https://spring2024.byucs110.org/resources/bit-reference/

Homework 1c — While

1. Blue square

Run the code in blue_square.py. You will notice that it has an error. Can you fix it? The final world should look like this:

a blue square

2. Go to the lake

Bit wants to get to the lake. He doesn’t know how to get there. He asks for directions.

Bit: “How do I get to the lake?”

Helpful passerby: “Take a left at the stop sign.”

Write your code in go_to_lake.py. There are two starting worlds; in both worlds, bit starts at the bottom, pointing up towards a red square, with the lake on the left. This one of the starting worlds:

starting world for Bit to go to the lake

This is how it should look when Bit has arrived at the lake:

ending world for Bit to go to the lake

3. Red line

Bit needs to leave his room (black squares), finish the red line, and return to his room.

Write your code in red-line.py. This is the starting world:

starting world for this problem

This is how it should look after Bit finishes their task:

ending world for this problem

Manual Grading

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

Remember to break the problem down into functions with one clear purpose.

Go to lake and red line both tell a story. We want you to practice decomposition. For full points, use multiple functions on these two problems.

Intent

The intent of this assignment is for you to correctly use while loops.

  • Code that calls bit.move() many times is likely incorrect.
  • While loops that only run once are unnecessary, and we will point them out to you.
  • Only one line in blue_square.py should be changed.
RubricPoints
Whitespace1
Naming1
Decomposition4
Intent4
Total10

Grading

ActivityPoints
blue_square.py4
go_to_lake.py8
red_line.py8