CMU 15-112: Fundamentals of Programming and Computer Science
Homework 6 (Due Saturday 9-Oct at 8pm)
Important notes:
- Collaborative:
- This homework is meant to be entirely collaborative in teams set up by your recitation TA's.
- This must be earnest collaboration, with both of you genuinely working together the whole time. It is not acceptable for one of you to do the work, or any portion of the work, and for the other to copy any portion of that work. All work must come from earnest collaboration from both of you.
- Solo:
- If you plan to work solo, which we do not recommend in any case, then you must obtain explicit permission via email from your recitation TA's before you start working on the assignment.
- Grace Days:
- Using a grace day only applies to you, not your partner.
- If you use a grace day, your partner may only continue to work with you after the Saturday 8pm deadline if they also use a grace day.
- In any case, if your partner attends the solution session, then they cannot discuss any part of this homework with you no matter how briefly.
- To start:
- Create a folder named 'week6'
- Download all of these to that folder:
- Edit hw6.py
- Even if you are working with a partner, each of you must type your own hw6.py, and each of you must submit your own hw6.py to Autolab.
- When you have completed and fully tested hw6, submit hw6.py to Autolab. For this hw, you may submit up to 5 times, but only your last submission counts.
- Do not use recursion this week.
- Do not hardcode the test cases in your solutions.
Note: To help prepare you for our upcoming midterm, the first few exercises involve practice from previous semester midterm1's.
- Attend Friday Lab [10 pts]
Friday Lab attendance is required this week. In Friday Lab, we will practice some non-free-response questions from previous semester midterm1's. - nthSortOfSquarish(n) [5 pts] [manually graded, collaborative]
Working with your hw6 partner, write nthSortOfSquarish(n), and its helper functions, as described in s21-midterm1a. - animation() [5 pts] [manually graded, collaborative]
Working with your hw6 partner, write the animation from s21-midterm1a. Note that this animation is in the same file as your Tetris animation. To allow this, we are using the fnPrefix feature of runApp here, with the prefix of s21MidtermAnimation_. Thus, for example, instead of redrawAll(app, canvas), here you would write s21MidtermAnimation_redrawAll(app, canvas). The starter file contains a fun little placeholder animation using the properly-named functions for this exercise. - Tetris [80 pts] [manually graded, collaborative]
Reminder: This must be earnest collaboration. You may not copy any code from your collaborator (or anyone else) by any means (electronically, on paper, by sight, etc). All work must be done truly in collaboration, working together, not copying.
With this kind of positive collaboration in mind, 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 decide to add some more bonus, which we do not require but we heartily encourage (not for the few points you might earn, but rather for the joy of learning and creating), then:- Have the code run normally, without any bonus features, so the TA's 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 the TA's can understand how to use and grade your bonus features.
Have fun!