Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

my blackjack game functions very weird

hadthelad
hadthelad

so i made a blackjack game (not complete though) and some things work and others don't. if you know the rules black jack and how it works cool. so here is how its working so far (BTW it has no errors i'm just confused) so first off its supposed to give the dealer and the player 2 cards which is technically true with mine. but for some reason it only shows the dealers cards and not the players as shown here.

blackjack game 1

and another problem is that when i type hit it does its job of giving me a card. but the problem is it will usually give me 4 to 5 cards. i think the problem here is that it doesn't know the limit of how many cards are supposed to be appended.

so if anyone could help me solve these 2 problems that would be great thanks, BTW here is the code:

https://repl.it/@hadthelad/blackjack

3 years ago

Voters

Comments

TopNew
1
ncizjp
ncizjp

Oh, I had a similar problem when I tried to create something more complex than a slot gacor game. I'm a fan of slot gacor, so I tried to create my alternative version of this game. There was an option to create Black Jack, but I thought adding more elements would look more original, colorful, and modern. I wasted my money on an app. How can I fix this? My app is now hidden from Google Play since it's terribly glitchy. Among the comments, I've found little actionable advice or specific codes that can be used to fix the map hiding problem. My problem is the constant glitches and cards falling out of the deck. Sometimes my opponent sees not the back of the card, but my entire combination, as if the card has a suit visible on both sides.

3 months ago
1
ndeyeresistance
ndeyeresistance

What does your game look like visually? Is it possible to see a screenshot?

3 months ago
1
sylashur
sylashur

There should be a game loop with two loops inside, or just the game with one loop after the setup, the player actions should be inside the loop. The players cards should be printed unconditionally at the beginning of the loop and the player should be unconditionally asked for their next action after their cards are shown. Staying, getting blackjack, and busting should all cause the loop to stop, if you want this to be the end of the game and the player would need to reset the repl code you don't need to add a loop afterwards, however if you do want there to be a loop afterwards, this loop shouldn't be too difficult.

3 years ago
1
sylashur
sylashur

The loop that compares the players cards to 2 should be while len(player_cards) < 2:

3 years ago
1
hadthelad
hadthelad

@sylashur

yea it didn't work it did the exact same thing of only printing the dealers cards but not the players

3 years ago
1
sylashur
sylashur

@hadthelad
Oh yeah that's not what that fixes

3 years ago
Load more