#include #include #include #include #include #include using namespace std; class card { public: int num; string type; }; class RandomGenerator { public: RandomGenerator() { srand(time(0)); } int operator()(int remaining) const { return static_cast ( ((0.0 + remaining) * rand()) / (RAND_MAX + 1.0) ); } }; class poker { private: vector pcards; RandomGenerator rg; public: poker() { string types[4]; types[0] = "Kreuz"; types[1] = "Pik"; types[2] = "Herz"; types[3] = "Karo"; for ( int t=0; t<4; t++ ){ for ( int n=0; n<8; n++ ){ card c; c.num = n+7; c.type = types[t]; pcards.push_back(c); } } } void shuffle() { // random_shuffle( pcards.begin(), pcards.end() ); random_shuffle( pcards.begin(), pcards.end(), rg ); }; void print() { for ( int i=0; i countCards; // die ersten 5 Karten for ( int i=0; i<5; i++ ) { int n = pcards[i].num; if ( countCards.count(n) == 0 ) { countCards[n] = 1; } else { countCards[n] ++; } } // 2 unterschiedliche Kartentypen fuer full-house if (countCards.size() != 2 ) return false; int somenum = pcards[0].num; if ( countCards[somenum] == 2 || countCards[somenum] == 3 ) { return true; } else { return false; } }; }; int main() { poker mygame; const int ngames = 100000; int nfh = 0; for ( int i=0; i