To start this assignment, download this zip file.
The following guide pages cover material needed for this assignment:
Project 2 - Bit Problems
Inverting the World
Bit is in a world with a blue picture on a white background:
Invert the entire world. Blue should become empty, and empty should become blue. Bit should end in the lower right corner. The final world should look like this:
There is a second world that looks like this:
and when Bit is done it should look like this:
You can find starter code in invert.py
.
Blue S
Move Bit to the right edge of the grid. Along the way, if Bit encounters a green square, draw a blue āSā. The bends in the āSā are marked by blocked squares.
The first world looks like this:
and at the end should look like this:
The second world looks like this:
You can find starter code in blue_s.py
.
Escape
Bit is exploring a cave and finds a secret gem that has been hidden for centuries:
Unfortunately, his enemies have started to flood the cave with water! Help Bit escape by (1) picking up the gem, (2) running through the cave, (3) climbing the moss-covered cliff at the end. The final world should look like this:
The water has followed Bit as they run, and Bit has put down the gem to examine it.
There is a second world that looks like this:
and the at the end should look like this:
Note that the gem may be a ruby (red) or an emerald (green).
You can find starter code in escape.py
.
Pools of Gems
When Bit was examining the gem, they discovered a secret ingredient that lets them replicate gems. So Bit goes to their backyard, where there are a bunch of empty holes. Bit picks up a gem, then fills the next pool with copies of that same gem.
Note: There are many different colors of gems. You will need to write generic code that will work with any color.
One of the starting worlds looks like this:
at the end, the world should look like this:
The other starting world looks like this:
at the end, the world should look like this:
Manual Grading
The Quality Code guide page has good examples that may be useful to you as you decide whether to put code in functions or leave it outside a function as glue code.
Grading will be focused on decomposition of the problems into separate functions. In particular, you should identify repeated actions and use functions to represent those actions. For example, the top and bottom arms of blue_s are the same action.
Intent The intent of this project is for you to break problems into large pieces, write code that solves worlds of any size, and write generic functions that take multiple arguments.
Remember, nested while loops make your functions hard to read. Use additional functions to break the problem into readable, descriptive pieces.
Rubric | Points |
---|---|
Whitespace | 5 |
Naming | 5 |
Decomposition | 20 |
Intent | 20 |
Total | 50 |
Grading
Activity | Points |
---|---|
Inverting the World | 25 points |
Blue S | 25 points |
Escape | 25 points |
Pools of Gems | 25 points |