Fixed shuffle and deal bugs
This commit is contained in:
@@ -72,9 +72,10 @@ void pokerNewRound() {
|
|||||||
POKER_DECK_SIZE = CARD_DECK_SIZE;
|
POKER_DECK_SIZE = CARD_DECK_SIZE;
|
||||||
|
|
||||||
// Shuffle Deck
|
// Shuffle Deck
|
||||||
for(i = CARD_DECK_SIZE-1; i > 0; i--) {
|
for(i = POKER_DECK_SIZE-1; i > 0; i--) {
|
||||||
|
k = rand();
|
||||||
|
j = k % (i+1);
|
||||||
k = POKER_DECK[i];
|
k = POKER_DECK[i];
|
||||||
j = rand() % (i+1);
|
|
||||||
POKER_DECK[i] = POKER_DECK[j];
|
POKER_DECK[i] = POKER_DECK[j];
|
||||||
POKER_DECK[j] = k;
|
POKER_DECK[j] = k;
|
||||||
}
|
}
|
||||||
@@ -108,7 +109,7 @@ void pokerNewRound() {
|
|||||||
|
|
||||||
// Deal two cards to the player.
|
// Deal two cards to the player.
|
||||||
for(j = 0; j < POKER_PLAYER_HAND_SIZE_MAX; j++) {
|
for(j = 0; j < POKER_PLAYER_HAND_SIZE_MAX; j++) {
|
||||||
POKER_PLAYERS[i].hand[j] = POKER_DECK[POKER_DECK_SIZE--];
|
POKER_PLAYERS[i].hand[j] = POKER_DECK[--POKER_DECK_SIZE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user