def cluedCard(self,
color: Color,
value: Value,
player: Optional[int]=None,
strict: bool=False,
maybe: bool=False) -> Optional[int]:
p: Player
c: int
card: CardKnowledge
for p in self.game.players:
if player == p.position:
if strict:
continue
# When it is the player, assume fully tagged cards as clued too
for c in p.hand:
card = cast(CardKnowledge, self.game.deck[c])
if card.color == color and card.value == value:
return card.deckPosition
if p is self:
if (maybe and card.maybeColor == color
and card.maybeValue == value):
return card.deckPosition
elif p is self:
for c in p.hand:
card = cast(CardKnowledge, self.game.deck[c])
if card.color == color and card.value == value:
return card.deckPosition
if (maybe and card.maybeColor == color
and card.maybeValue == value):
return card.deckPosition
else:
for c in p.hand:
card = cast(CardKnowledge, self.game.deck[c])
if (card.clued
and card.suit == color
and card.rank == value):
return card.deckPosition
return None
评论列表
文章目录