Ejemplo n.º 1
0
 def absolute_positions(self, me_position=None):
     if me_position is None:
         me_position = NORTH
     positions = [None, None, None, None]
     positions[me_position] = self.me
     positions[rho_of(me_position)] = self.rho
     positions[lho_of(me_position)] = self.lho
     positions[partner_of(me_position)] = self.partner
     return positions
Ejemplo n.º 2
0
    def possible_calls_over(self, history):
        if history.is_complete():
            return

        yield Call('P')

        last_non_pass = history.last_non_pass()
        caller = history.position_to_call()
        if last_non_pass and history.last_to_not_pass() != partner_of(caller):
            if last_non_pass.is_contract():
                yield Call('X')
            elif last_non_pass.is_double():
                yield Call('XX')

        last_contract = history.last_contract()
        for level in range(1, 8):
            if last_contract and level < last_contract.level():
                continue
            for strain in STRAINS:
                if last_contract and level == last_contract.level() and strain <= last_contract.strain:
                    continue
                yield self._make_call(level, strain)