A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 3 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 http://ideone.com/r5wr3u To run the code, save it locally in the same folder as the graphics.py 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

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.