| 271 | |
| 272 | |
| 273 | class Dealer(User): |
| 274 | def __init__(self, name): |
| 275 | super().__init__(name=name, role="Dealer", color="PURPLE") |
| 276 | self.trigger = 0 |
| 277 | |
| 278 | def ask_insurance(self): |
| 279 | buy_insurance = ( |
| 280 | "(Insurance pay 2 to 1)\n" |
| 281 | "\tMy Face card is an Ace.\n" |
| 282 | "\tWould your like buy a insurance ?" |
| 283 | ) |
| 284 | self.speak(content=buy_insurance) |
| 285 | |
| 286 | def strategy_trigger(self, deck): |
| 287 | if self.is_point("<", BASE_VALUE): |
| 288 | self.obtain_card(deck) |
| 289 | else: |
| 290 | self.trigger += random.randint(0, 5) |
| 291 | if self.trigger % 5 == 0: |
| 292 | self.obtain_card(deck) |
| 293 | |
| 294 | |
| 295 | class Player(User): |