CodeWittJonas / masterthesis-experiment

0 stars 0 forks source link

Implement Blackjack Player #12

Open dave7m opened 1 year ago

dave7m commented 1 year ago

Before we can implement the Game Logic itself, we must first implement the Player. You can see the rules down below. The Player should have a wallet, which get's initialized with a value of 100. Also, a player should have a modifiable playerNumber field (to distinguish between players) and a bet field (because a player can place a bet - any valid amount of money).

RULES: a. The Player make their bets. b. The Player is dealt two cards. c. Dealer is dealt two cards where the second card is hidden from the Player. d. The objective of the game is to have a higher point total than the dealer (but no more than 21, anything over 21 is an automatic loss called a bust) — if the Player beat the dealer in this way, they win from the casino what they bet (they also win if the dealer busts). Aces can be worth either 1 or 11; every other card is worth its face amount (face cards are worth 10). e. An initial two card hand composed of an ace and a face card is called a blackjack and is the best possible hand. f. After the first round of dealing, the Player has the option to hit (receive more cards) or stay (no more cards). If hitting results in the Player busting (total going over 21), then their bet is lost. g. After the Player is done hitting/staying, the Dealer flips over their hidden card. If the Dealer’s total is less than 17, then they need to hit (receive a new card). This process repeats until the Dealer’s hand either totals to 17 or more or busts (goes above 21). h. After the Dealer is done, the final results are decided — if the Dealer busts, then the player who did not bust earlier wins their bet. If the Dealer does not bust, then the Dealer’s total is compared to the Player’s. If the Player’s total is greater than the Dealer’s, the Player wins money (in the amount that was bet). If the Player’s total is less than the Dealer’s, the Player loses money. No money is exchanged in the event of a tie

dave7m commented 1 year ago

todo: shorten rules