hwoodward / Remote-Card-Games

Program for playing card games online/remotely. Goal is to play a game of hand and foot with multiple groups in different locations.
MIT License
2 stars 1 forks source link

Storing meld groups #22

Closed hwoodward closed 4 years ago

hwoodward commented 5 years ago

Is a part of the design not going to actually work? Please describe how and why. We need to keep track of what cards go in which set for hand and foot in a way that works for both passing them around, checking each set is legal, checking if a set is clean or dirty, checking if a set is a caniesta, identifying which set you are adding to, and not having duplicate sets of the same card.

Describe the solution you'd like Current plan is to make a dictionary in python with an id for each grouping played of the number of then natural card in the set, followed by a list of the cards in the set in no particular order (if rendering you could shuffle them to put black or red on top). If we were to expand to something like liverpool later we might need to change the keys, since you can have duplicate runs so basing it on contents is weird, but the idea of an identifier to avoid duplicate sets and then a list of cards included which allows duplicates can hold. (Although for runs the ordering matters and you would need to verify contents was actually a run).

Describe alternatives you've considered We could do a simple list of lists, but duplicate avoidance would be more complex, and it might not lend itself to nice UI features for identifying which set you were adding a wild card to.

slwoodward commented 5 years ago

"publicInfo will contain an an ordered list of player names and their cards" -- I'm going to start working on TableView, which will display the publicInfo. Is this a valid example of what publicInfo might equal (this example assumes that only Ted has melded: ( (Ted,{1: ( (1,Hearts),(1,Hearts),(1,Spades),(0,None) ), 4:( (4,Diamonds), (4,Clubs), (4 Clubs) ), 13: ((13, Hearts),(13,Hearts), (2,Hearts) )}, (Sheri,{ } ), (Miriam, {}), (Helen, {}) )

hwoodward commented 4 years ago

So - turns out we aren't passing names at all (we should add that to the public info, either as part of the hand status or as its own list). The dicts look like: {1:[Card(1,'Spades'), Card(1,'Hearts'), Card(0, None)], 5: [Card(5, 'Clubs'), Card(5, 'Clubs'), Card(5, 'Clubs')]}

hwoodward commented 4 years ago

This is finalized - we are using dicts with a key and then a list of cards. The hand and foot ruleset is implemented with that design.