Python Forum
Implementation Pyramid Solitaire
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Implementation Pyramid Solitaire
#3
(Feb-27-2017, 11:47 AM)ichabod801 Wrote: 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.

I also say that the patterns are not very suitable for this task, but the condition of laboratory work to do with the implementation of design patterns
Reply


Messages In This Thread
Implementation Pyramid Solitaire - by qwerty - Feb-27-2017, 11:16 AM
RE: Implementation Pyramid Solitaire - by qwerty - Feb-27-2017, 11:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help with my assignment please - game of Solitaire Muzz 6 6,641 Sep-28-2021, 07:36 PM
Last Post: Underscore
  print a * pyramid drogers10940 5 4,715 Apr-26-2020, 09:25 PM
Last Post: prothej227
  Pyramid of leters of n levels DanyMont1505 4 2,195 Sep-27-2019, 07:56 PM
Last Post: woooee
  Pyramid gamingingrs 1 2,294 Oct-16-2018, 02:56 PM
Last Post: j.crater
  Pyramid of Solitaires qwerty 1 3,470 Mar-22-2017, 04:10 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020