Updated setup_player static method to permit each player to provide their starting ships.

This commit is contained in:
Donald Calloway 2025-09-19 10:00:37 -07:00
parent e44e9acc27
commit 5e705d5ca8

View File

@ -4,7 +4,7 @@ import random
from collections import Counter
from hand_utils import evaluate_hand, Tuple, List, Card, SUITS, RANKS
starting_chips = 1000 # Default starting chips for each player
starting_chips = 0 # Default starting chips for each player
rank_counts = Counter()
@ -13,7 +13,22 @@ def setup_players():
num_players = int(input("Enter number of players (25): "))
if not 2 <= num_players <= 5:
raise ValueError("Must be between 2 and 5 players.")
return [Player(f"Player {i+1}", starting_chips) for i in range(num_players)]
players = []
for i in range(num_players):
name = f"Player {i+1}"
while True:
try:
starting_chips = int(input(f"Enter starting chips for {name}: "))
if starting_chips <= 0:
print("Starting chips must be a positive number.")
continue
break
except ValueError:
print("Please enter a valid integer.")
players.append(Player(name, starting_chips))
return players
@staticmethod
def deal_round(deck, players, round_num):