Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Blackjack algorithm
- 1) Display "WELCOME TO BLACKJACK" title
- 2) Display the rules of Blackjack and how to play it.
- 3) Show the user their balance and ask them how much more would they like to deposit.
- 4) Get information from user.
- 5) Show the user their balance and ask them how much they would like to bet.
- 6) Get information from user.
- 7) Display the User's hand and show the current value of their hand.
- 8) Display the Dealer's faced up card and show they have one facing down.
- 9) Ask the user if they want to hit or stay.
- 10) Get information from user.
- 11) If the user hits, give them another card and Repeat steps 7-9.
- If the User busts, display a message showing that they busted
- Display the amount that they lost and show their current balance.
- Ask them the user if they want to play again.
- Get information from User
- If they say "Y" then start over from step 3.
- If they say "N" Display a goodbye message and show whether they won or lost money and how much.
- 12) If the User stays, end their turn and show the dealers cards.
- 13) If the dealer's total value is less than 17, give them another card and display total value. Repeat until the dealer busts or has a value of 17 or higher.
- 14) If the Dealer busts, display a message showing that the dealer busted.
- Display the amount that the user won and their current balance
- Ask them the user if they want to play again.
- Get information from User
- If they say "Y" then start over from step 3.
- If they say "N" Display a goodbye message and show whether they won or lost oney and how much.
- 15) If the Dealer gets a total value between 17-21, stop dealing cards.
- 14) Check the User's and Dealer's total value of their cards and compare them.
- 15) If the User has a higher calue than the Dealer, without either of them busting
- Display a message showing that the User won
- Display the amount that they won and show their current balance.
- Ask them the user if they want to play again.
- Get information from User
- If they say "Y" then start over from step 3.
- If they say "N" Display a goodbye message and show whether they won or lost oney and how much.
- 16) If the Dealer has a higher value than the User, without either of them busting
- Display a message showing that the User lost.
- Display the amount that the user lost and their current balance
- Ask them the user if they want to play again.
- Get information from User
- If they say "Y" then start over from step 3.
- If they say "N" Display a goodbye message and show whether they won or lost oney and how much.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement