Пример #1
0
 def call_partner(self, game_events=None):
     if game_events:
         for event in game_events:
             if event.type == CALL_EVENT:
                 current_card_values = self.get_deck_values()
                 partner = event.call
                 partner = cards.convert_input_string(partner)
                 if partner in current_card_values:
                     return False, "Please call a card outside of your hand"
                 elif cards.card_check(partner):
                     return partner, ""
                 else:
                     return False, "Invalid card call"
     return False, ''
Пример #2
0
    def call_partner(self):
        """
        The procedure to call a partner
        :return: A valid card value
        """
        current_card_values = self.get_deck_values()
        while True:
            partner = input(
                "Please call your partner card. Enter card number + suit number \n"
                "e.g. qs is Queen Spade, 8c is 8 Clubs, ah is Ace Hearts\n")

            partner = cards.convert_input_string(partner)
            if partner in current_card_values:
                print("Please call a card outside of your hand")
            elif cards.card_check(partner):
                return partner
            else:
                print("Invalid card call")
Пример #3
0
    def make_a_play(self, substate, game_events=None):
        """
        The procedure to make a play in a round
        :return: A valid Card
        """
        msg = ''
        while True:
            play = input(
                "Please play a card.Enter card number + suit number \n"
                "e.g. qs is Queen Spade, 8c is 8 Clubs, ah is Ace Hearts\n")
            #if play == "v":
            #    pprint.pprint(self._table_status)
            #else:
            play = cards.convert_input_string(play)
            if play > 0:
                valid = self.check_for_valid_plays(play, substate == 0)

                if valid:
                    [_, pos] = self.check_card_in(play)
                    return self.remove_card(pos), msg

                print("Invalid play")