blackjack/blackjack.py

29 lines
539 B
Python
Raw Normal View History

2022-12-22 04:58:31 -05:00
from src.deck import Deck
2022-12-27 23:47:12 -05:00
from src.io import CLI
2022-12-22 04:58:31 -05:00
from src.gamemaster import GameMaster
2022-12-20 23:51:27 -05:00
2022-12-31 01:07:12 -05:00
kill = False
ui = CLI()
print(ui.intro)
num_decks = ui.get_decks()
if num_decks == 'q':
kill = True
deck = Deck(num_decks)
while not kill:
2022-12-31 00:47:08 -05:00
game = GameMaster(deck)
2022-12-31 01:07:12 -05:00
game.active = True
2022-12-22 04:58:31 -05:00
2022-12-31 00:47:08 -05:00
game.deal()
2022-12-20 23:51:27 -05:00
while game.active:
2022-12-31 00:47:08 -05:00
print(ui.update(game))
if not game.blackjack():
game.handle_player_input(ui.player_move(deck.count()), kill)
print(ui.update(game))
2022-12-22 19:15:38 -05:00
2022-12-27 23:47:12 -05:00
if not ui.play_again():
kill = True
2022-12-31 01:07:12 -05:00