Questions tagged [playing-cards]

Programming questions involving digitally-represented playing cards. This includes issues like representing cards and decks in data structures, user interfaces for manipulating cards in a virtual fashion, implementing correct algorithmic shuffling, and using cryptographically secure protocols to exchange cards over a network. Please browse this tag with your target language (e.g. [java] [playing-cards]) to see if your question has been asked before!

324 questions
-2
votes
2 answers

Filling a Java array with elements produced in another class

I'm trying to fill a deck of cards in my "Deck" class with cards created in my "Card" class. When I print the result in my Deck class, I get 52 "null"s, which tells me the two are communicating, just not very well. I've copied the code below. Where…
P0bbn
  • 1
  • 1
-2
votes
2 answers

python - Unresolved reference and I don' know why?

I'm trying to make a small program that tells you what your chances of getting a particular card are and asks for what cards were drawn. When it gets to asking for what card was drawn it says Unresolved reference in the code and Im not sure what it…
-2
votes
1 answer

How to draw card from deck without repeating in C?

I shuffled the array but now I need a function to draw a card from the array in the order of the shuffled deck. I can't seem to figure out how to draw the next card in the deck. How would I increment to the next card everytime I draw a card? Would I…
wuve
  • 1
-2
votes
1 answer

How to do high performance comparisons within a fixed set of options in Python 3.7?

I am struggling with the proper way to represent a fixed set of options (playing card characteristics) for the most efficient comparisons later in development. In the playing card example you have rank (2 to 10, Jack, King, Queen, Ace) and suit…
Caesar Kabalan
  • 753
  • 1
  • 8
  • 18
-2
votes
1 answer

Java - Created a deck of cards, dealt five now need to determine whether the hand contains a pair

As the topic may explain, I need to figure out if out of the five cards dealt to the player are any of them considered a pair, If there is a pair it would be printed as part of the final JOptionPane to state "You have a pair of [pair]" Is there a…
Ahsifs
  • 11
  • 2
-2
votes
3 answers

How do I make the "action" of this card game keep executing until a winner is found?

I created this card game that asks the user for an action. "attack" and "swap". they both work fine on the first execution, but how do I make it so that the system keeps asking the user for an action until one of the player wins? This contains my…
user8638151
  • 21
  • 1
  • 7
-2
votes
1 answer

Adding Card Images C#

I have been tasked with creating BlackJack in C# for my final project. C# is fairly foreign to me so I'm having trouble with assigning images to my cards. Right now I have a cards class: public class Card { private string face; private…
JoeRamDo
  • 11
  • 2
-2
votes
1 answer

python class cant find its own attribute

I tried to create classes to represent a deck of cards. The problem is that the showDeck method doesn't find the cards list and prints out: Traceback (most recent call last): File "C:\Users\User\workspace\learn\cards\Deck.py", line 32, in…
ubailey71
  • 1
  • 2
-2
votes
3 answers

how to return an array string, where the string array is combined with other string arrays in C?

I wanted to return a specific array string from a deck of 52 playing cards, where this string array 'deck[]' has combined string arrays: suits and values. How would you do this and will you show me the code on how you do this? My…
-2
votes
3 answers

How to make cards work in python

This is my code so far: import sys import os import random Question(): os.system('cls') SQ=input('Do you want to play blackjack y/n') if(SQ == y or SQ == Y): StartGame() if(SQ == n or SQ == N): sys.exit() if(SQ !=…
-2
votes
1 answer

Making card game, need to add JLabels to JPanel at runtime based on how many cards in player's hand

In my game, the player's hand will typically be around 5 cards (and a separate ArrayList), but can get massive quickly with a lot of "draw cards" options in the game. Everywhere else that cards are displayed, I have them in a JLabel which updates to…
-2
votes
1 answer

Cannot print cards in card game

I'm developing a java card game, which is close to the card game hearts. I have much of the structure, but now i'm stuck and i cannot get this to print. It has a variable amount of players and - I need it to deal out five cards to each player - To…
-3
votes
2 answers

How to simulate a card been played in a card game?

I am developing a card game using WPF and since i do not have any knowledge about animations i would like to know if someone could help me in how to write an animation to simulate a Card ( Image ) been played over a table. At the bottom and top of…
-3
votes
3 answers

Making a deck of cards on Java using arrays and objects?

My textbook gave me this code saying that it'll create a new set of 52 cards. I don't really understand what it does, because the methods I see on google is very different from this. I'm confused about what the "index" variable does and how can I…
-3
votes
2 answers

c++ : Deck not showing first card

I am actually trying to create a bluff game of cards in c++. When I call the function showAllCards the card at the of the deck ( Ace of Hearts ) does not show on output, the only way to show it is to add both deck structures in main body.And when…
1 2 3
21
22