Пример #1
0
 def get_action(self, game: GameDriver, hand: BlackjackHand):
     if hand.is_splittable() and self.should_i_split(
             hand, game.dealer_card):
         return BlackjackAction.Split
     elif hand.is_soft():
         highest_value = hand.get_hand_total()
         return self.soft_action_grid.loc[highest_value][
             game.dealer_card.value]
     else:  # Hard hand
         highest_value = hand.get_hand_total()
         return self.hard_action_grid.loc[highest_value][
             game.dealer_card.value]
Пример #2
0
 def get_action(self, game: GameDriver, hand: BlackjackHand):
     if hand.is_soft():
         if hand.get_hand_total() >= 17 + (
                 1 if Ruleset.rules().get("dealer_hits_on_soft_17") else 0):
             return BlackjackAction.Stay
         else:
             return BlackjackAction.Hit
     else:
         if hand.get_hand_total() >= 17:
             return BlackjackAction.Stay
         else:
             return BlackjackAction.Hit
Пример #3
0
 def get_action(self, game: GameDriver, hand: BlackjackHand):
     if (Ruleset.rules().get("late_surrender") and hand.is_surrenderable()
             and self.df_surrender.loc[hand.get_hand_total(),
                                       game.dealer_card.value]):
         return BlackjackAction.Surrender
     elif hand.is_splittable() and self.df_split.loc[
             hand.cards[0].value, game.dealer_card.value]:
         return BlackjackAction.Split
     elif hand.is_soft():
         df = self.df_soft
         return df.loc[hand.get_hand_total(), game.dealer_card.value]
     else:
         df = self.df_hard
         return df.loc[hand.get_hand_total(), game.dealer_card.value]
Пример #4
0
 def test_is_soft(cls, soft_hand: BlackjackHand):
     assert soft_hand.is_soft()