-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented hand and trick play logic, added team class, placeholder …
…player methods, rule_util with implemented trick_winner function, todos
- Loading branch information
1 parent
a0e629e
commit 9bae74b
Showing
4 changed files
with
156 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
from euchrecli.card_util import Card, Suit | ||
from euchrecli.player_util import Player | ||
|
||
def valid_play(card_to_play: Card, played_cards: [Card], trump_suit: Suit) -> bool: | ||
# TODO: implement | ||
return True | ||
|
||
def trick_winner(players: [Player], played_cards: [Card], trump_suit: Suit): | ||
""" | ||
determine winner of trick by trump and lead weighted card values | ||
""" | ||
lead_suit = played_cards[0].suit | ||
|
||
high_value = 0 | ||
winning_player = None | ||
for idx, card in enumerate(played_cards): | ||
weighted_value = card.weighted_value(trump_suit, lead_suit) | ||
if weighted_value > high_value: | ||
high_value = weighted_value | ||
winning_player = players[idx] | ||
|
||
return winning_player | ||
|
||
def score_hand(team_called: int): | ||
# TODO: implement | ||
pass |