Thread: Poker Game

  1. #16
    Registered User
    Join Date
    Oct 2004
    Posts
    34
    okay, i have taken all considerations and have done this so far,i printed my code and output but it still isnt working how i want it to
    thanks

    code
    Code:
    void filldeck(Card *deckptr)
    {
     char x;
     char y;
     for(x=3;x<7;x++)
     {
      for(y=2;y<14;y++)
      {
       deckptr -> suitValue = x;
       deckptr -> faceValue = y;
      }
      deckptr++;
     }
     return;
    }
    
    void shuffledeck(Card *deckptr)
    {
    Card temp[52];
        int x, y, m = 52 / 2;
    
        for (x = 0, y = 0; x < 52; x += 2, y++)
    	{
            temp[x] = deckptr[y];
            temp[x + 1] = deckptr[m + y + 1];
        }
    
        for (x = 0; x < 52; x++)
            deckptr[x] = temp[x];
     
    	return;
    }
    
    void dealdeck(Card *deckptr , Card handsDealt [4][5])
    {
     int i;
     char faces[]={"023456789TJQKA"};
      
     printf("\n");
      for(i=0;i<5;i++)
     {
      printf("%26c of %c, \n",faces[deckptr[i].faceValue], deckptr[i].suitValue);	
     }printf("\n");
      for(i=0;i<5;i++)
     {
      printf("%c of %c, ",faces[deckptr[i].faceValue], deckptr[i].suitValue);
      printf("%43c of %c, \n",faces[deckptr[i].faceValue], deckptr[i].suitValue);
     }
       
     printf("\n");
        for(i=0;i<5;i++)
     {
      printf("%26c of %c, \n",faces[deckptr[i].faceValue], deckptr[i].suitValue);	
     }printf("\n");
     
    	return;
    }
    output
    Code:
                             A of ♥,
                             A of ♦,
                             A of ♣,
                             A of ♠,
                             ╠ of ╠,
    
    A of ♥,                                           A of ♥,
    A of ♦,                                           A of ♦,
    A of ♣,                                           A of ♣,
    A of ♠,                                           A of ♠,
    ╠ of ╠,                                           ╠ of ╠,
    
                             A of ♥,
                             A of ♦,
                             A of ♣,
                             A of ♠,
                             ╠ of ╠,
    Last edited by egomaster69; 01-03-2005 at 06:34 PM. Reason: taking out snippits of code so im not writing anyone elses program

  2. #17
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    Code:
    void filldeck(Card *deckptr)
    {
     char x;
     char y;
     for(x=3;x<7;x++)
     {
      for(y=2;y<14;y++)
      {
       deckptr -> suitValue = x;
       deckptr -> faceValue = y;
      }
      deckptr++;
     }
     return;
    }
    you still have a problem with this function.

    Do you have a debugger at all? Can you step through this code and see why you are ending up with a deck of just the four aces?

    As I said before look at this code and think about how many times deckptr++; is called. Which loop is it in and how many times is that loop executed? These are the question you should be asking yourself.

  3. #18
    Registered User
    Join Date
    Oct 2004
    Posts
    34
    okay when i move the deckptr++ into the loop for the cards the numbers change but the sit value stay the same??? Sorry but i am at a loss to debugging my program!?! Why is this so hard??
    Code:
    void filldeck(Card *deckptr)
    {
     char x;
     char y;
     for(x=3;x<7;x++)
     {
      for(y=2;y<14;y++)
      {
       deckptr -> suitValue = x;
       deckptr -> faceValue = y;
    	deckptr++;
      }
     }
     return;
    }
    output
    Code:
                             3 of ♥,
                             4 of ♥,
                             5 of ♥,
                             6 of ♥,
                             7 of ♥,
    
    3 of ♥,                                           3 of ♥,
    4 of ♥,                                           4 of ♥,
    5 of ♥,                                           5 of ♥,
    6 of ♥,                                           6 of ♥,
    7 of ♥,                                           7 of ♥,
    
                             3 of ♥,
                             4 of ♥,
                             5 of ♥,
                             6 of ♥,
                             7 of ♥,

  4. #19
    Registered User
    Join Date
    Oct 2004
    Posts
    34
    hey hey before anyone responds I FIGURED IT OUT!!!
    thank you everyone for ur help, ill prob be hearing from u next week again

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. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM
  5. world of problems with poker game
    By blight2c in forum C++ Programming
    Replies: 5
    Last Post: 04-21-2002, 08:00 PM