def handState(self,
player: int,
showCritical: bool=True) -> List[HandState]:
handState: List[HandState]
handState = [HandState.Unclued] * len(self.game.players[player].hand)
c: int
h: int
card: CardKnowledge
for c, h in enumerate(self.game.players[player].hand):
card = cast(CardKnowledge, self.game.deck[h])
if card.worthless is True:
handState[c] = HandState.Worthless
continue
if card.playWorthless is True:
handState[c] = HandState.Worthless
continue
if card.playable is True:
handState[c] = HandState.Playable
continue
if card.valuable is True:
handState[c] = HandState.Saved
continue
if card.clued:
handState[c] = HandState.SoonPlay
continue
if showCritical and player != self.position:
if self.isValuable(card.suit, card.rank):
handState[c] = HandState.Critical
elif card.rank == Value.V2 and self.is2Valuable(card.suit):
handState[c] = HandState.Critical2
return handState
评论列表
文章目录