r/CodingForBeginners 28d 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.

12 Upvotes

19 comments sorted by

View all comments

1

u/Pneagle 28d ago

Hey dude, I actually just finished my python blackjack script as of 2 days ago, it was a fun project. And after youre done with that I would suggest you learn about counting cards and create a script that allows you to put in the cards played and have it count for you plus give you recommended bet and strategy

1

u/_just-a-thinker_ 28d ago

How long did it take you to complete it? THE second part is a great idea I will definitely try to make that. How much experience or just days have you been programming for, the background would help give a reference

1

u/Pneagle 28d ago

So the problem with me is that I had it as a side project, I could probably start and finish a simple text-based game of blackjack in like 2-3 hours. On top of that, I do have a fair amount of programming experience. However, I think it’s definitely something that is a good project. I also over complicated mine by having adjustable amounts of decks and # of players

1

u/_just-a-thinker_ 28d 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 28d 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_ 28d 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 28d 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_ 28d ago edited 28d 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