bot.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Hanabi-AI 作者: MeGotsThis 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号