geekcomputers / geekcomputers/Python

Error with Blackjack_game

Open
#676 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
35.4k
Forks
12.9k
Avg merge
2h 37m
Merged PRs (30d)
1

Description

blackjack.py:
On line 89, the datatype for the user input is a string which doesn't match up with the datatype for the if statement condition on line 90. Since the else statement is automatically executed, the player stays even if wanting to play their hand. A quick fix would be to change line 89 to:

k = int(input('Want to hit or stay?\n Press 1 for hit and 0 for stay '))

blackjack_rr.py:
The total amount of chips the player has doesn't carry over to the next game. A quick fix would be to move line 184 to right before the while statement:

#GAMEPLAY

player_chips = Chips()

while True:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the input handling around line 89 in blackjack.py and the player_chips initialization around line 184 in blackjack_rr.py. Run both blackjack examples manually to confirm hit/stay input works and the player's chip total persists across games. Done means both reported behaviors are corrected without changing the gameplay flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.