예제 #1
0
파일: players.py 프로젝트: dima42/hanabot
    def get_move(self, gamestate):
        move = None

        self.set_known_playable(gamestate)
        for i in range(4, -1, -1):
            card = gamestate.player_cards[self.num][i]
            if card.known_playable:
                move = ('play', i)
                break

        if gamestate.clues > 0:
            pc = util.partner_playable_clue(
                partner_cards=gamestate.player_cards[(self.num+1)%2],
                gamestate=gamestate,
                ordering='mode',
                full_knowledge=True,
            )
            if pc and not move:
                move = ('clue', pc)

        dis = util.get_discard(
            gamestate.player_cards[self.num],
            gamestate,
            ordering='oldest'
        )
        if not move:
            move = ('discard', dis)

        if self.debug:
            print move
        return move
예제 #2
0
파일: players.py 프로젝트: dima42/hanabot
    def get_move(self, gamestate):
        move = None
        jc =  util.newest_just_clued(gamestate.player_cards[self.num], gamestate)
        if jc:
            move = ('play', jc)

        if gamestate.clues > 0:
            pc = util.partner_playable_clue(
                partner_cards=gamestate.player_cards[(self.num+1)%2],
                gamestate=gamestate,
                ordering='newest',
                full_knowledge=False,
            )
            if pc and not move:
                move = ('clue', pc)

        dis = util.get_discard(
            gamestate.player_cards[self.num],
            gamestate,
            ordering='newest'
        )
        if not move:
            move = ('discard', dis)

        if self.debug:
            print move
        return move