![]() |
|
#1
|
|||
|
|||
Poker game and random numbers...I am trying to make a texas hold'em poker game and the problum I am running into is that the 2nd pocket card and the 1st flop card always come up the same. I am very new to this and I get confused easily, but any help would be appreciated. Heres the code:
CPP / C++ / C Code:
Last edited by dsmith : 06-Nov-2004 at 08:26.
Reason: Please use [c] & [/c] for syntax highlighting
|
|
#2
|
|||
|
|||
|
Firstly, you can get rid of about nine tenths of your code by first printing to a string, then printing output, and not having an if() statement for every single possible outcome. You can also use if else statments instead and declaring the srand() for every random number isn't needed because every next rand() call you make, it takes the previously generated random number as the seed. You can do something like this to elimate a lot of your code, and call this as a seperate function for every generated random number. (apologies for using C, but I know very little abou the calls for C++)
CPP / C++ / C Code:
|
|
#3
|
||||
|
||||
|
Quote:
One of the wonderful thing about repeated data is that you can reduce common information to a variable that can be called again and again. Here is an example that will print out seven cards that are randomly selected. CPP / C++ / C Code:
|