Section 1. A Bit of Fun


Written by Juliette Woodrow, Tara Jones, and Ecy King

Written by Juliette Woodrow, Tara Jones, and Ecy King

This week in section, your first priority is to meet your section leader and discover what sections in CS106A are all about. Your section leader will spend the first part of this week's session on introductions and telling you the things you need to know. Afterwards, they will move on to cover some of the important material from class in a setting that is small enough for you to go over practice problems and ask questions. This week, your goal is to gain familiarity with Bit problems and the coding environment.


Reverse Santa

In this problem, your goal is to help bit get up a chimney! Use the bit syntax from lecture to help solve this world! Move bit forward until an open square appears above - the chimney! Move bit up the chimney until an open square appears to the right. Move bit to that square.

Reverse Santa Code

Here is an example run of the function:

Start:

Reverse Santa

End:

Reverse Santa

Holes

This problem has two functions. The first function deals with filling a single hole(fill_hole):

Bit has a wall at its back and is facing into a hole that is 1 or more squares deep. Move bit forward until blocked, painting every moved-to square blue. This will fill the hole with blue. Then return to the original location and face down.

The second function deals with filling all the holes (fill_all), and calls the first function, fill_hole.

Move bit forward until blocked. For each moved-to square, if there is hole to the right, fill it with blue.

Holes Code

Here is an example run of the function:

Start:

End:

Standard Santa

In this problem your job is to define a function to help Bit get down a chimney! Bit/Santa is on the roof, facing the left side of the world. Move bit forward until an opening appears below - the chimney. Move bit down the chimney (into the house) until blocked. Turn right at the bottom, and move until blocked. Paint green all the squares bit occupies in the house.

Standard Santa Code

Here is an example run of the function:

Start:

Bit at square to the right of top of chimney, facing left

End:

Bit at the bottom left of the corridor, with the path painted green.