示例#1
0
 def define_trumpf(self, start_player_index):
     is_allowed_trumpf = False
     generator = self.players[start_player_index].choose_trumpf(geschoben=self.geschoben)
     chosen_trumpf = next(generator)
     if chosen_trumpf == Trumpf.SCHIEBEN:
         self.geschoben = True
         generator = self.players[(start_player_index + 2) % 4].choose_trumpf(geschoben=self.geschoben)
         chosen_trumpf = next(generator)
         while not is_allowed_trumpf:
             is_allowed_trumpf = trumpf_allowed(chosen_trumpf=chosen_trumpf, geschoben=self.geschoben)
             trumpf = generator.send(is_allowed_trumpf)
             chosen_trumpf = chosen_trumpf if trumpf is None else trumpf
     self.trumpf = chosen_trumpf
示例#2
0
 def is_trumpf_allowed(self, chosen_trumpf):
     return trumpf_allowed(chosen_trumpf, self.geschoben)
示例#3
0
def test_trumpf(trumpf, geschoben, result):
    assert trumpf_allowed(chosen_trumpf=trumpf, geschoben=geschoben) == result