Example #1
0
    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
Example #2
0
 def set_known_playable(self, gamestate):
     full_knowledge_generated = False
     for c in gamestate.player_cards[self.num]:
         c.known_playable = util.known_legal(c, gamestate)
         if (c.known_playable and 
             (c.turns_color_clued == 1 or c.turns_number_clued == 1)):
             full_knowledge_generated=True
     jc =  util.newest_just_clued(gamestate.player_cards[self.num], gamestate)
     if jc is not False:
         # we assume this card is marked as playable unless it is known illegal
         card = gamestate.player_cards[self.num][jc]
         if not util.known_illegal(card, gamestate) and not full_knowledge_generated:
             card.known_playable = True
             assert gamestate.stacks[card.color] == (card.number - 1)
             card.turns_color_clued = 1
             card.turns_number_clued = 1