CMU 15-112: Fundamentals of Programming and Computer Science
Homework 8 (Due Saturday 27-Mar at 8pm): 2d Lists + Tetris!


Important notes:
  1. isRectangular(L) [5 pts] [autograded]
    Write the function isRectangular(L) that takes a possibly-2d (or possibly not) list L and returns True if the list is in fact 2d, and if it is also rectangular, so each row has the same number of elements. Return False otherwise.

  2. makeMagicSquare(n) [10 pts] [autograded]
    Write the function makeMagicSquare(n) that takes a positive odd integer n and returns an nxn magic square by following De La Loubere's Method as described here. If n is not a positive odd integer, return None.

  3. Tetris [85 pts] [manually graded]
    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!