コード例 #1
0
    def bid(self, currentBids):
        """Invoked for each bot when it has an option of bidding."""  
        highestCurrentBid = BiddingUtilities.highest_current_bid(currentBids)
        
        potentialBid = Bid(self.identifier, None, None, 'pass')
        if self.handValue >= 10 and not(any(filter(lambda x: x.bidType != 'pass', currentBids))):
            longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
            longestSuit = 'nt'            
            return Bid(self.identifier, 1, longestSuit, 'bid')

        if self.handValue >= 11 and not BiddingUtilities.has_partnership_bid(currentBids):            
            longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
            longestSuit = 'nt'
            potentialBid = Bid(
                self.identifier, 
                BiddingUtilities.next_legal_bid(highestCurrentBid, longestSuit), 
                longestSuit, 
                'bid')
        
        if len(currentBids) > 2 and currentBids[-2].bidValue is not None and currentBids[-2].bidValue < 2:
            if self.handValue > 6 and currentBids[-2].bidSuit is not None and self.suitLengths[currentBids[-2].bidSuit] > 2:
                potentialBid = Bid(
                    self.identifier, 
                    BiddingUtilities.next_legal_bid(highestCurrentBid, currentBids[-2].bidSuit), 
                    currentBids[-2].bidSuit, 
                    'bid')
                
        return potentialBid
コード例 #2
0
    def bid(self, currentBids):
        """Invoked for each bot when it has an option of bidding."""
        highestCurrentBid = BiddingUtilities.highest_current_bid(currentBids)

        potentialBid = Bid(self.identifier, None, None, 'pass')
        if self.handValue >= 10 and not (any(
                filter(lambda x: x.bidType != 'pass', currentBids))):
            longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
            longestSuit = 'nt'
            return Bid(self.identifier, 1, longestSuit, 'bid')

        if self.handValue >= 11 and not BiddingUtilities.has_partnership_bid(
                currentBids):
            longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
            longestSuit = 'nt'
            potentialBid = Bid(
                self.identifier,
                BiddingUtilities.next_legal_bid(highestCurrentBid,
                                                longestSuit), longestSuit,
                'bid')

        if len(currentBids) > 2 and currentBids[
                -2].bidValue is not None and currentBids[-2].bidValue < 2:
            if self.handValue > 6 and currentBids[
                    -2].bidSuit is not None and self.suitLengths[
                        currentBids[-2].bidSuit] > 2:
                potentialBid = Bid(
                    self.identifier,
                    BiddingUtilities.next_legal_bid(highestCurrentBid,
                                                    currentBids[-2].bidSuit),
                    currentBids[-2].bidSuit, 'bid')

        return potentialBid
コード例 #3
0
    def bid(self, currentBids):
        """Invoked for each bot when it has an option of bidding."""
        highestCurrentBid = BiddingUtilities.highest_current_bid(currentBids)

        potentialBid = Bid(self.identifier, None, None, 'pass')

        minOpenPoints = 10
        openBid = 1
        if self._ourState.belowTheLine >= 70:
            minOpenPoints = 5
        elif self._ourState.belowTheLine >= 40:
            minOpenPoints = 8
            openBid = 2

        # enough points to open and no previous bids
        if self.handValue >= minOpenPoints and not (any(
                filter(lambda x: x.bidType != 'pass', currentBids))):
            longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
            longestSuit = 'nt'
            potentialBid = Bid(self.identifier, openBid, longestSuit, 'bid')

        # enough points to open and previous bids from other partnership
        if self.handValue >= 11 and not BiddingUtilities.has_partnership_bid(
                currentBids):
            highestCurrentBid = BiddingUtilities.highest_current_bid(
                currentBids)
            longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
            longestSuit = 'nt'
            potentialBid = Bid(
                self.identifier,
                max(
                    BiddingUtilities.next_legal_bid(highestCurrentBid,
                                                    longestSuit), openBid),
                longestSuit, 'bid')

        # raise partner's bid
        if len(currentBids) > 2 and currentBids[
                -2].bidValue is not None and currentBids[-2].bidValue < 2:
            if self.handValue > 6 and currentBids[
                    -2].bidSuit is not None and self.suitLengths[
                        currentBids[-2].bidSuit] > 2:
                potentialBid = Bid(
                    self.identifier,
                    BiddingUtilities.next_legal_bid(highestCurrentBid,
                                                    currentBids[-2].bidSuit),
                    currentBids[-2].bidSuit, 'bid')

        return potentialBid
コード例 #4
0
 def bid(self, currentBids):
     """Invoked for each bot when it has an option of bidding."""  
     highestCurrentBid = BiddingUtilities.highest_current_bid(currentBids)
     
     potentialBid = Bid(self.identifier, None, None, 'pass')
     
     minOpenPoints = 10
     openBid = 1
     if self._ourState.belowTheLine >= 70:
         minOpenPoints = 5
     elif self._ourState.belowTheLine >= 40:
         minOpenPoints = 8
         openBid = 2
         
     # enough points to open and no previous bids 
     if self.handValue >= minOpenPoints and not(any(filter(lambda x: x.bidType != 'pass', currentBids))):
         longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
         longestSuit = 'nt'
         potentialBid = Bid(self.identifier, openBid, longestSuit, 'bid')
     
     # enough points to open and previous bids from other partnership
     if self.handValue >= 11 and not BiddingUtilities.has_partnership_bid(currentBids):
         highestCurrentBid = BiddingUtilities.highest_current_bid(currentBids)
         longestSuit = max(self.suitLengths.items(), key=lambda x: x[1])[0]
         longestSuit = 'nt'
         potentialBid = Bid(
             self.identifier, 
             max(BiddingUtilities.next_legal_bid(highestCurrentBid, longestSuit), openBid), 
             longestSuit, 
             'bid')
     
     # raise partner's bid        
     if len(currentBids) > 2 and currentBids[-2].bidValue is not None and currentBids[-2].bidValue < 2:
         if self.handValue > 6 and currentBids[-2].bidSuit is not None and self.suitLengths[currentBids[-2].bidSuit] > 2:
             potentialBid = Bid(
                 self.identifier, 
                 BiddingUtilities.next_legal_bid(highestCurrentBid, currentBids[-2].bidSuit), 
                 currentBids[-2].bidSuit, 
                 'bid')
             
     return potentialBid