Example #1
0
    def chooseCard(self, player):
        # Summary: Instructs players to choose a rank of card that they also have in their hand to eventually ask another player
        # 	that is chosen.
        from Card import Card

        if isinstance(player, Bot):
            # Implement Bot Card Choosing. Game will not work without this. What I eventually want to to is
            #  1. Bot looks through hand for cards they have
            #  2. Of cards that bot has, look for the rank in which you have the most of.
            #  2a. If you have multiple ranks with the same amount, break by choosing randomly
            #  3. As for the selected rank from an opponent.
            bot = player
            bot.chooseCard()
        else:
            rank = None

            if not self.variant:
                while True:
                    rank = raw_input(
                        "What card rank do you want to ask for (e.g. 2 - Ace)?: "
                    ).lower().title()
                    flagCard = Card(rank)
                    if not flagCard.acceptableRank():
                        print "\nError: That is not an acceptable card rank. Please choose again."
                    elif not player.hasCard(flagCard):
                        print "\nError: You don't even have any of those cards in your hand! Try again."
                    else:
                        player.setChosenCard(Card(rank))
                        break