Homework 7
Due Tuesday 22-Oct, at 9:00pm
To start
- Create a folder named
hw7
- Create
hw7_tetris.py
(We are not providing starter files this week.)
- Edit
hw7_tetris.py
and build Tetris as described below.
- Solve the list problem on CS Academy.
- When you have completed and fully tested hw7, submit
hw7_tetris.py
to the appropriate location on Gradescope.
- If you did the Tetris bonus, then fill out the Tetris bonus form.
Some important notes
- This homework is solo. You may not collaborate or discuss it with anyone outside of the course,
and your options for discussing with other students currently taking the course are limited.
See the academic honesty policy for more details.
- Do not hardcode the test cases in your solutions.
- Remember the course’s academic integrity policy. Solving the homework yourself is
your best preparation for exams and quizzes; cheating or short-cutting your learning
process in order to improve your homework score will actually hurt your course grade
long-term.
Limitations
Do not use sets, dictionaries, try/except, classes, or recursion this week.
The autograder (or a manual CA review later) will reject your submission entirely if you do.
A Note About Style Grading
Like in the previous assignment, we will be grading your code based on whether
it follows the 15-112 style guide. We
may deduct up to 10 points from your overall grade for style errors. We highly
recommend that you try to write clean code with good style all along, rather
than fixing your style issues at the end. Good style helps you code faster and
with fewer bugs. It is totally worth it. In any case, style grading already
started, so please use good style from now on!
A Note About Testing
There is no skeleton file provided this week, meaning that we also are not providing testcases. You should write testcases for the autograded function. (You can find some nice ways to test in the write-up below, but you will need to translate those to actual testcases.)
For Tetris, as stated in the style guide,
you do not have to write test cases for interactive, random, graphics, data
initialization or event functions. Instead, you should test by visually
inspecting your code’s behavior as you complete steps of each problem, where
reasonably possible. This will make debugging your code much easier.
Problems
-
isBoxy [25 pts]
Complete the problem isBoxy(board)
from CS Academy.
You must solve the problem directly on the website, doing all of your testing there. Do not write the solution in Thonny (or a different IDE) and copy/paste it into the website.
-
Tetris [75 pts] [manually graded]
Write Tetris according to the design given in this step-by-step tutorial.
You may not use a different design, even if you think there's a better way to do it (there probably is, but you still have to do it this way).
This may seem limiting, but sometimes you have to write code according to a specific algorithm, rather than writing code to solve a specific problem.
To get full credit, you'll need to complete the basic implementation according to the design spec.
If you are interested, you may add additional features and improvement for a few bonus points. What sort of features? Whatever you think improves the game!
Bonus features are not required, but we do heartily encourage them (not for the few points you might earn, but rather for the joy of learning and creating).
If you decide to add bonus features, then...
- Have the code run normally, without any bonus features, so we can easily grade your submission against the spec.
- But if the user presses 'b', then the game switches to bonus mode, and the bonus features are activated.
- When the user presses 'b' to activate the bonus features, a description of all the bonus features is printed to the console. Be sure to print enough of an explanation that we can understand how to use and grade your bonus features.
Have fun!