Feb-27-2017, 11:47 AM
I update the tags in your post for you. Please copy plain text code, so that there are no formatting tags in the post. Otherwise we can't copy and run your code to find any problems with it.
There are several ways to implement an iterator. The easiest way to do this with an object like you've got is to override __iter__ to return an iterator over the list of cards. However, you've got two lists of cards, which is confusing. I would just shuffle the first list of cards (using random.shuffle), and not create a second list of cards. Also, that would just give you an iterator over the cards. Is the iterator supposed to yield the rows, not the individual cards?
I'm not sure about design patterns, I don't use those.
There are several ways to implement an iterator. The easiest way to do this with an object like you've got is to override __iter__ to return an iterator over the list of cards. However, you've got two lists of cards, which is confusing. I would just shuffle the first list of cards (using random.shuffle), and not create a second list of cards. Also, that would just give you an iterator over the cards. Is the iterator supposed to yield the rows, not the individual cards?
I'm not sure about design patterns, I don't use those.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures