Card Game – Where the aim is to get your cards closer to 21 than the dealer, while not going over. J, Q, K are worth 10. A are either 11 or 1.
Questions tagged [blackjack]
464 questions
-3
votes
1 answer
Edit!!! Blackjack game creation in Python, error occurred while it played
The code worked, but the results were not what I want to get.
Blackjack game is supposed to provide 'A' as 1 or 11, but it was not working
By some reasons, if I 'h' (hit) the card, it won't let me go back to 's'(stand)
If I got blackjack, dealer…

NEWBIEOFPYTHONS
- 85
- 1
- 1
- 7
-3
votes
2 answers
Blackjack str iteration error
I am converting an array into a string to print, but the compiler still says not iterable.
Traceback (most recent call last):
File "python", line 157, in
File "python", line 56, in total
TypeError: 'int' object is not iterable
The…

Jonathan K
- 1
- 2
-3
votes
1 answer
java blackjack pair hand
So basically I'm trying to test to see if my hand of 5 cards has a pair in it (two cards have the same value (1-9)) and I'm getting an unknown error and this is my code
Error:
java.lang.AssertionError at…

masonft
- 9
- 5
-3
votes
1 answer
Adding my items to an ArrayList
I have created 52 cards to be added to my ArrayList the only problem is when I try to get the first item in the list I can an outofboundserror because I don't think anything has been added to my ArrayList.
private ArrayList deck;
public…

Ian
- 29
- 2
- 6
-3
votes
1 answer
Java ArrayList Out of Bounds Exeption
I am making a blackjack game (NON GUI) and I will write algorithms to decide whether to receive another card, how much to bet, etc. I am receiving an out of bounds error on the ArrayList when I am adding values. Thank you for your help.
package…

user5657150
- 39
- 4
-3
votes
1 answer
I stole card game c++ header code and it won't compile... duuhhh
I am a newbie c++ (but fair experience visual basic, visual foxpro) and I'm trying to get to write a blackjack console program. I borrowed (stole, used, etc.) header file snippet from an old thread (Generating a Deck of Cards).
This is the…

NipperDJ
- 1
- 2
-3
votes
1 answer
I have made a BlackJack game myself but a part of the program does not execute
What the problem is that in between User2's input is not accepted?
public static void main() throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int user1total = 0, user2total=0, i;
…

Kevin Mathew
- 1,427
- 2
- 9
- 9
-3
votes
1 answer
blackjack game for python
I am making a blackjack game on Python for a school project. I have made the main part of my game but I keep getting a syntax error. I have tried to debug it, but I can not work out what is wrong.
Here is my code -
def total(hand):
aces =…

nasher99
- 1
- 1
- 4
-4
votes
2 answers
How to get this deal card fuction working for a BlackJack game?
import random
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
human_cards = []
ia_cards = []
def deal_card(x):
int(random.choice(cards))
return x
deal_card(human_cards)
print(human_cards)
When I print it out it gives me the below…

Hercules
- 19
- 5
-4
votes
1 answer
Blackjack Ace functionality python
Need help getting the 11 to become 1 when over 21. Anytime a player has 11 and they go over 21 the 11 should convert into a 1? Also if the player decides to hit and is over 11 and the dealt card comes out 11 it should convert to a 1. This is a…

MR.J
- 1
- 4
-4
votes
2 answers
how do I use else and if statements
both of my options are coming up when I run the code
I have tried two if statements else if and else
cout << "would you like to hit or stand?" << endl; //asking if you would ike to hit or stand
bool hit; //the hjitting opption
bool stand; // the…

Chris.B
- 7
- 1
-4
votes
1 answer
Blackjack, python
import random
import time
class card():
def __init__(self):
cardNum = ["1","2", "3", "4", "5", "6", "7", "8", "9", "10", "10", "10"]
randNum = random.randint(0, len(cardNum) - 1)
cardSuit = ["Hearts", "Clubs",…

K.Blemings
- 21
- 1
- 1
- 4
-4
votes
1 answer
Working on a blackjack style unity game. Can't read and write a file
So. I'm trying to make a save profile but I have the error shown in the picture and have no idea how to fix it as I have been following tutorials on YouTube and this error never occurred. Can anyone help me work out what I should do.
using…

HAllen
- 15
- 2
-5
votes
2 answers
I'm trying to do a blackjack in python
I am in the process of doing blackjack, but I have a problem.
I don't know how to do that if I want him to print for example the Q to print it as str, but when adding the player's hand I take it as a 10.
The error it gives me is: TypeError:…

iMaGiikz
- 1
- 1