#include // std::cout #include // std::random_shuffle #include // std::vector #include // std::time #include // std::rand, std::srand #include using namespace std; enum Color {CARREAU, COEUR, PIQUE, TREFLE}; enum Rank {AS = 1, VALET = 11, DAME, ROI}; struct Card { Color c; // Couleur int r; // Rang }; bool operator<(const Card &a, const Card &b) { if (a.r < b.r) return true; else if (a.r == b.r) return a.c < b.c; else return false; } void disp(const vector &tas) { for (auto it(tas.begin()); it != tas.end(); it++) { cout << "C:" << it->c <<"; R:"<< it->r << endl; } } void disp(const set &jeu) { for (auto it(jeu.begin()); it != jeu.end(); it++) { cout << "C:" << it->c <<"; R:"<< it->r << endl; } } void piocher(vector &tas, set &jeu) { jeu.insert(tas.back()); tas.pop_back(); } /* Essaye de jouer, et sinon pioche. */ void jouer(vector &pioche, vector &pile, set &jeu) { // Peut jouer la même couleur Card instCard; instCard.c = pile.back(); // Essaye tous les numéros // ... find avec set // Essaye le numéro et d'autres couleurs // Pioche } int main(int argc, char const *argv[]) { // Variables const int nbPlayer(2); int curPlayer(0); Card instCard; vector pioche; vector pile; for (int c(0); c < 4; c++) for (int r(AS); r < 14; r++) { instCard.c = (Color)c; instCard.r = r; pioche.push_back(instCard); } set jeu[nbPlayer]; // Init random_shuffle(pioche.begin(), pioche.end()); for (int k(0); k < nbPlayer; k++) { for (int c(0); c < 3; c++) { piocher(pioche, jeu[k]); } } // Fin return 0; }