I am writing a card game "Drunkard".

struct card{ int, rank; }; vector <card> first, second; 

Vectors first and second are players, card is a card, and rank is rank cards. Both vectors are filled with 18 card elements. I hope the principle of the game everyone knows.

Help to realize the game itself, that is, a comparison of the cards and the selection of cards (by the way, the withdrawn cards should not be put in a separate pile but under yours, first your own then the enemy). The game ends when one of the players runs out of cards.

Maybe not the best implementation option, but I started to do it and decided to finish it off. Or tell me how best to implement it all.

Closed due to the fact that the issue is too common for the participants Kromster , user194374, dirkgntly , αλεχολυτ , jmu 25 Aug '16 at 14:40 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • In my opinion, you should not declare vector <person>, but vector <card> first, second; I did not understand the composition of the card structure: what is int, rank ;? - BuilderC
  • @BuilderC why separately? Only three identical queues: cards of two players and cards of a deck. The structure of the card is two inta: face value and color (for beauty). - user6550
  • I would do through a cyclical list. Each player has his own. For the cards laid out on the table, you can use stacks (for each player has its own). This data structure most naturally follows the rules of the game . Comparing maps is obvious - arithmetic operations > and == (and, in general, the search for the maximum) over the top of the stacks. - avp
  • @klopp, I thought that at the beginning of the game, each had half a deck on his hand. And the played pair is placed either on the table or under the bottom of the deck that is on the winning hand. I haven’t played drunk for a long time. - BuilderC
  • one
    @ klopp, played with pleasure. - BuilderC

0