Modified game to shuffle deck 7 times
This commit is contained in:
parent
238240fa50
commit
0347d361d5
@ -4,7 +4,7 @@ import random
|
||||
import time
|
||||
from collections import Counter
|
||||
from hand_utils import evaluate_hand, Tuple, List, Card, SUITS, RANKS
|
||||
import copy
|
||||
|
||||
|
||||
starting_chips = 0 # Default starting chips for each player
|
||||
rank_counts = Counter()
|
||||
@ -47,11 +47,10 @@ def deal_round(deck, players, round_num):
|
||||
print(player.show_hand())
|
||||
|
||||
@staticmethod
|
||||
def determine_winner(players, pot):
|
||||
def determine_winner(players, _pot):
|
||||
best_score = (-1, -1)
|
||||
|
||||
winner = None
|
||||
pot = pot
|
||||
pot = _pot
|
||||
|
||||
for player in players:
|
||||
if player.folded:
|
||||
@ -226,17 +225,12 @@ def reset_round(players):
|
||||
class Deck:
|
||||
def __init__(self):
|
||||
self.cards: List[Card] = [Card(rank, suit) for suit in SUITS for rank in RANKS]
|
||||
random.seed(time.time()) # Seed random number generator with current time
|
||||
self.shuffle_multiple_times()
|
||||
|
||||
def shuffle_multiple_times(self, times: int = 7, delay: float = 0.1): # Shuffle deck 7 times
|
||||
for _ in range(times):
|
||||
random.shuffle(self.cards)
|
||||
deck = copy.deepcopy(self.cards)
|
||||
time.sleep(0.1)
|
||||
random.shuffle(deck)
|
||||
time.sleep(0.1)
|
||||
random.shuffle(deck)
|
||||
time.sleep(0.1)
|
||||
random.shuffle(deck)
|
||||
time.sleep(0.1)
|
||||
random.shuffle(deck)
|
||||
time.sleep(delay)
|
||||
|
||||
def deal_card(self) -> Card:
|
||||
return self.cards.pop(0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user