add method to check for criticality of card
This commit is contained in:
parent
c0e63fe17e
commit
40baa59bd3
1 changed files with 11 additions and 0 deletions
|
@ -310,6 +310,17 @@ class GameState:
|
||||||
def is_trash(self, card: DeckCard):
|
def is_trash(self, card: DeckCard):
|
||||||
return self.stacks[card.suitIndex] >= card.rank
|
return self.stacks[card.suitIndex] >= card.rank
|
||||||
|
|
||||||
|
def is_critical(self, card: DeckCard):
|
||||||
|
if card.rank == 5:
|
||||||
|
return True
|
||||||
|
if self.is_trash(card):
|
||||||
|
return False
|
||||||
|
count = 0
|
||||||
|
for hand in self.hands:
|
||||||
|
count += hand.count(card)
|
||||||
|
count += self.deck[self.progress:].count(card)
|
||||||
|
return count == 1
|
||||||
|
|
||||||
def holding_players(self, card):
|
def holding_players(self, card):
|
||||||
for (player, hand) in enumerate(self.hands):
|
for (player, hand) in enumerate(self.hands):
|
||||||
if card in hand:
|
if card in hand:
|
||||||
|
|
Loading…
Reference in a new issue