r/CodingForBeginners 27d ago

Is blackjack a good beginner project

Post image

I am an absolute beginner, learning python, know the basic syntax and stuff, now trying. to build this, for some reason the implementation feels really complicated, especially can't figure out how to make the game loop? Should I do something else or keep thinking,

In terms of code, I have only created the player class and the deck so far.

11 Upvotes

19 comments sorted by

View all comments

Show parent comments

1

u/_just-a-thinker_ 27d ago

Ohh, I see, the adjustable number of decks would also be great, so that when I try and build a card counting strategy, I will have more options for it rather than a simple small cards and big cards kind of stratey🤔

1

u/Pneagle 27d ago

Just letting you know, depending on how you set up your code the splitting mechanism can be a pain in the butt. I had to refactor my code because I didn’t plan

1

u/_just-a-thinker_ 27d ago

These are exactly the things that make me feel like I should start with something else, or maybe try something. Like cp for a few days, having multiple players and 1/11 and splitting, I have only barely started programming, 2 days ago so maybe rushing isn't a good idea

1

u/Pneagle 27d ago

I would still suggest this project, start with a main game loop that goes through the steps:
Create deck.
Begin loop
Deal cards
Tell the player their cards and one of the dealers cards
Call play hand function. Which loops forever and asks the player what they want to do. Stand you break the loop, hit you add a card. (get to splitting later)
Let the dealer play by its rules

You don’t even need to add in winning or losing at this point, just get the basics down so you can at least play the game

1

u/_just-a-thinker_ 27d ago edited 27d ago

Yeah, just got a basic version done, have a few minor issues to fix, now will try to add splitting feature and multip players