bot.py 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号