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.
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!