Beispiel #1
0
    def give_card(self, cards_on_table, trump, turn, row, score):
        CLI.situation(cards_on_table, trump, turn, row, score, self._cards)

        print('Please, select a card to give, ' + self._name + ': ')
        selected_card = input('==> ')
        card = self.verify_choice(selected_card, cards_on_table, trump, turn,
                                  row, score)

        self._cards.remove(card)
        return card
Beispiel #2
0
    def give_card(self, cards_on_table, trump, turn, row, score):
        CLI.situation(cards_on_table, trump, turn, row, score, self._cards)

        print('Please, select a card to give, ' + self._name + ': ')
        selected_card = input('==> ')
        card = self.verify_choice(selected_card, cards_on_table, trump, turn,
                                  row, score)

        self._cards.remove(card)
        return card
Beispiel #3
0
    def verify_choice(self, card, cards_on_table, trump, turn, row, score):
        rank, suite = self.parse_input(card)

        while not self.is_card(rank, suite):
            CLI.situation(cards_on_table, trump, turn, row, score, self._cards)
            print('Please, select a card, ' + self._name + ': ')
            selected_card = input('==> ')
            return self.verify_choice(selected_card, cards_on_table, trump,
                                      turn, row, score)

        while not self.is_card_from_hand(rank, suite):
            CLI.situation(cards_on_table, trump, turn, row, score, self._cards)
            print('Please, select a card from your hand, ' + \
                  self._name + ': ')
            selected_card = input('==> ')
            return self.verify_choice(selected_card, cards_on_table, trump,
                                      turn, row, score)

        while not self.is_right_suite(suite, cards_on_table):
            CLI.situation(cards_on_table, trump, turn, row, score, self._cards)
            print('Please, select a card with proper suite, ' + \
                  self._name + ': ')
            selected_card = input('==> ')
            return self.verify_choice(selected_card, cards_on_table, trump,
                                      turn, row, score)

        return self.the_card(rank, suite)
Beispiel #4
0
    def verify_choice(self, card, cards_on_table, trump, turn, row, score):
        rank, suite = self.parse_input(card)

        while not self.is_card(rank, suite):
            CLI.situation(cards_on_table, trump, turn, row, score,
                          self._cards)
            print('Please, select a card, ' + self._name + ': ')
            selected_card = input('==> ')
            return self.verify_choice(selected_card, cards_on_table, trump,
                                      turn, row, score)

        while not self.is_card_from_hand(rank, suite):
            CLI.situation(cards_on_table, trump, turn, row, score,
                          self._cards)
            print('Please, select a card from your hand, ' + \
                  self._name + ': ')
            selected_card = input('==> ')
            return self.verify_choice(selected_card, cards_on_table, trump,
                                      turn, row, score)

        while not self.is_right_suite(suite, cards_on_table):
            CLI.situation(cards_on_table, trump, turn, row, score,
                          self._cards)
            print('Please, select a card with proper suite, ' + \
                  self._name + ': ')
            selected_card = input('==> ')
            return self.verify_choice(selected_card, cards_on_table, trump,
                                      turn, row, score)

        return self.the_card(rank, suite)