Coverage for src / beaverbunch / core / player.py: 100.0%
9 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-09 19:37 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-09 19:37 +0000
1from dataclasses import dataclass
3from beaverbunch.core.hand import Hand
6@dataclass
7class Player:
8 """Represents a player in the game, holding a hand of cards and a name.
10 Attributes:
11 name: The name of the player.
12 hand: The player's hand of cards, which may contain known and unknown cards.
13 """
14 name: str
15 hand: Hand
17 def __post_init__(self) -> None:
18 if not self.name:
19 raise ValueError("Player name cannot be empty")
21 def get_points(self) -> int:
22 """Calculates the total points in the player's hand."""
23 return sum(card.points for card in self.hand)