DhanushNehru / Python-Scripts

A curated list of python scripts for automating your tasks
https://dhanushnehru.github.io/Python-Scripts/
MIT License
414 stars 187 forks source link

Update BlackjackGame.py #263

Closed dsg753 closed 1 month ago

dsg753 commented 1 month ago

PR Title

Update BlackjackGame.py

Summary

These improvements enhance the gameplay experience and make the Blackjack code more robust and user-friendly

Description

  1. Enhanced Betting Functionality:
  2. Improved Card Handling:
  3. Enhanced Game Logic:

The changes are as follows

  1. Enhanced Betting Functionality: Valid Bet Validation: The placeBet() method now ensures that players enter valid bets within the specified range and that they have sufficient funds. Clear Error Messages: Informative messages are provided for invalid inputs or insufficient funds.

  2. Improved Card Handling: Ace Value Adjustment: The adjustAceValue() method correctly handles cases where an ace's value should be reduced to 1 to prevent a bust.

  3. Enhanced Game Logic: Simplified Winner Determination: The playRound3() method now uses a separate determine_winner() function to improve code readability and maintainability.

  4. Additional Features: Initial Bankroll: Players now start with an initial bankroll of 1000 units. Betting Limits: Minimum and maximum betting limits have been introduced.

[dsg753]

epicadidash commented 1 month ago

Excellent work @dsg753 !!!

dsg753 commented 1 month ago

Thank you .

epicadidash commented 1 month ago

Are you on twitter @dsg753

dsg753 commented 1 month ago

Thank you

Yes Im on tweeter @dsg753

On Tue, Aug 27, 2024, 6:29 PM Adwait Dash @.***> wrote:

Are you on twitter @dsg753 https://github.com/dsg753

— Reply to this email directly, view it on GitHub https://github.com/DhanushNehru/Python-Scripts/pull/263#issuecomment-2312880860, or unsubscribe https://github.com/notifications/unsubscribe-auth/BKTGHM4MTUGM5ELJWA5IHELZTSLNDAVCNFSM6AAAAABNEH5K5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJSHA4DAOBWGA . You are receiving this because you were mentioned.Message ID: @.***>