No randomness
So I googled "random in C" (what I'm using for this stupid game.) and found a whole bunch of examples, but they all use the rand() function, and efforts to find the included h files were in vain. But I did do one thing (I think): Shortened the code a bit for the dealing. It looks like this:
for (i=0; i<5 ; i++) { // my stupid random code. carddifference=carddifference+3; if (carddifference>51) carddifference=14; Cardnumber[i]=cardtype+carddifference; if (Cardnumber[i]>52) Cardnumber[i]=Cardnumber[i]-52; // show cards. if (Cardnumber[i]<14) Suitnumber[i]=1; if ((Cardnumber[i]>13) && (Cardnumber[i]<27)) Suitnumber[i]=2, Cardnumber[i]=Cardnumber[i]-13; if ((Cardnumber[i]>26) && (Cardnumber[i]<40)) Suitnumber[i]=3, Cardnumber[i]=Cardnumber[i]-26; if (Cardnumber[i]>39) Suitnumber[i]=4, Cardnumber[i]=Cardnumber[i]-39; suit=Suitnumber[i]; cardtype=Cardnumber[i]; showcardforpoker1thru13(); cardx=cardx+7; }
Carddifference is also added to when the player needs to input something (like holding cards, or dealing a new game.) This is because I heard that a good way to randomize numbers is base it on user input. But it's not in this case. Right away, the player sometimes gets 2 pair, or a flush. I DON'T WANT THAT TO HAPPEN. I may just give up on this completely because, as usual, computers enjoy it when I get angry, so they do their best to ensure it.
1 Comment
Recommended Comments