Compare commits

..

1 Commits

Author SHA1 Message Date
e2c99dfea4 made game playable 2025-11-08 21:31:36 +01:00
2 changed files with 22 additions and 3 deletions

View File

@@ -11,8 +11,8 @@ class Game:
def __init__(self) -> None:
"""Creates instances of 'Deck', 'Player', and 'Dealer'."""
self.deck = Deck()
self.player = Player(0)
self.dealer = Dealer(1000)
self.player = Player(100)
self.dealer = Dealer(10000)
def compare_hands(self, bet: float) -> str:
"""*Resolution/Payout*: Compares final hand values, checks for
@@ -103,6 +103,20 @@ class Game:
player = self.player
dealer = self.dealer
# TODO: implement logic for setting the bet and passing the
# value to the hand comparison. Also keep the chip ammount of
# the player over multiple rounds.
# player starts with x amount and bets per round from his
# current chips. Internally the chips are handled as a float
# the player gets to see the float number as 'IS' and the
# rounded down number as 'Payout'
# HACK: this is just to fuck around and find out...
player_bet = input("How much do you want to bet?")
# player.chips += float(player_bet)
# Beginning of the round, the deck gets shuffled and all the
# player cards are shown, while the dealer only shows one card.
deck.shuffle()
@@ -131,7 +145,9 @@ class Game:
# Comparing hands and returning the winner of the game.
os.system("clear")
print(self.compare_hands(0))
print(self.compare_hands(float(player_bet)))
print(f"Player Chips: {player.chips}")
print(f"Dealer Chips: {dealer.chips}")
# After each full round, the players and dealers hand get
# cleared and a new deck is created.

View File

@@ -7,7 +7,10 @@ if __name__ == "__main__":
print("pyjack by cerberus")
print("do you wanna play a round??")
# Create game instance with the player and dealer
game = Game()
# Play the game
try:
while True:
game.play_round()