Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 2 years ago

Mechanical MOOC Handout 4, Exercise 4.3.2 Tetromino - Is there an inconsistency in the instructions? The instructions state "Create a Shape class that has a list of blocks as an attribute, and a draw method." Imo, this may make it seem that the parameter list for the __init__ method of the Shape class should include a list of blocks, so that's how I originally designed it. But then the instructions define an I_shape class that is a subclass of the Shape class. The __init__ method that is given for the I_shape class calls the __init__ method of the Shape class, but passes it a list of Points instead of a list of instances of the Block class that we defined earlier. Originally, I modified the I_shape class so it would handle Blocks instead of Points in order to get it to work with the Shape class. But, looking ahead at the Final Project - Tetris handout, it was evident that the Tetris project uses the same version of the I_shape class that is given in the instructions. So it seemed best, in the end, to go back and rewrite the Shape class to conform to pattern used for the given I_Shape class. For the resulting code, which works properly, see To run the code, save it locally in the same folder as the file provided by the course web site.

  • This Question is Closed

    Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy