MCPcopy Create free account
hub / github.com/geekcomputers/Python / Dealer

Class Dealer

BlackJack_game/blackjack_simulate.py:273–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271
272
273class 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
295class Player(User):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected