Thread: poker full house!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    27

    poker full house!!

    I want to print out all 3744 possible poker full houses. Right now I am just assigning cards to be numbers. I'll deal with that later. But here is what I have so far and I'm just getting bad data.

    Code:
    int main()
    {
    int array[] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; // if there is a pair or
                                                                   // 3 of  a kind it will add 1
                                                                   // to the appropriate space
    int count = 0; //  if count is 2 then there is a full house
    
      for(int i = 0; i <= 51; i++)
      {
        for(int j = i + 1; j <= 51; j++)
        {
          for(int k = j + 1; k <= 51; k++)
          {
            for(int l = k + 1; l <= 51; l++)
            {
             for(int m = l + 1; m <= 51; m++)
             {
               int i_i = i % 12;   // this is adding up pairs and 3 of a kind
               array[i_i] += 1;
               int j_j = j % 12;
               array[j_j] += 1;
               int k_k = k % 12;
               array[k_k] += 1;
               int l_l = l % 12;
               array[l_l] += 1;
               int m_m = m % 12;
               array[m_m] += 1;
    
               for(int z = 0; z <= 12; z++)
               {
                    if(array[z] == 2) count += 1;
                    if(array[z] == 3) count += 1;
    
                  if(count == 2)
                  {
                   cout <<i<<" "<<j<<" "<<k<<" "<<l<<" "<<m<<endl;
                  }
               }
             }
            }
          }
        }
                // this could very easily be wrong but I don't know when and
                // where to reset things
                  for(int q = 0; q <= 12; ++q)
                    {
                      array[q] = 0;
                    }
                    count = 0;
    
      }
      return 0;
    }
    Anybody out there with any advice??
    Last edited by noodle24; 05-19-2006 at 04:20 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help!For poker game simulation
    By tx1988 in forum C++ Programming
    Replies: 24
    Last Post: 05-25-2007, 09:59 PM
  2. Counting days
    By TheShaggmeister in forum C++ Programming
    Replies: 5
    Last Post: 07-17-2003, 10:29 AM
  3. hashing help
    By alokin in forum C Programming
    Replies: 17
    Last Post: 10-28-2002, 06:33 PM