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
-1
votes
2 answers

probability of getting three of a kind by drawing 5 cards

so my goal is to try to simulate an actaul deck and draw five cards and check if there is a three of a kind. I have no problem making the deck and drawing five cards, the problem arises when i check for three of a kind my code: from random import…
-1
votes
3 answers

I am making a website for playing a card game with firebase and I am using realtime database, but when someone draws an card it makes a endless loop

When someone draws a card (the shift function) like cardDeck.shift(); it takes a card out of the player's card deck then takes one out of the realtime databases informing the user playing against him to take a card out of there's. I feel this is the…
-1
votes
1 answer

How to exclude one item from an array based on another array's condition (for deck of playing cards)?

I have two arrays one for the card suit suit_list = ["Hearts", "Diamonds", "Clubs", "Spades"] and one for the values value_list = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"] I have written the code to select a card at…
Ossz
  • 314
  • 1
  • 10
-1
votes
2 answers

How can I create a list of tuples representing a deck of cards?

I am trying to make a deck of playing cards,where each is a tuple. For example, the card 'Ace of Hearts' with value of 11 would be (‘A’, ‘♥’, 11). How can I generate the entire deck without using classes and save it in a list?
-1
votes
1 answer

Shuffle under constraints

I have a question from a book on Monte Carlos Methods that I am working through and I can not figure it out. The question is as follows: Obtain random shuffles of the cards: club 2, 3, 4, 5, 6; diamond 2, 3, 4, 5, 6; heart 2, 3, 4, 5, 6; and spade…
Evan Raines
  • 3
  • 1
  • 1
-1
votes
1 answer

Programming Noob needs OOP advice

I have been making a blackjack game for a project in python and have has got as far as making a deck of cards (see below). But I want to improve it using objects instead as I think I will help me to improve my skills more. I was wondering if anyone…
JoshC
  • 13
  • 2
-1
votes
1 answer

Java Printing Out a Deck of Cards with an ArrayList and Nested For Loops

I need to print out a deck of 52 unique cards using an ArrayList and a nested for loop. I've done this just using arrays, but I can't wrap my head around using an ArrayList instead. Any help is appreciated, thank you. Instance Variables: public…
-1
votes
1 answer

How do I make my Random generator of poker cards to end when cards are over?

Android version: 4.2 I am developing an android App. I need to generate images from drawable folder randomly and set the text to say which card is been selected. I wish my app to enumerate every card randomly selected without repetitions until the…
-1
votes
1 answer

How to return the higher value of two cards?

I am creating a deck of cards and have to complete certain tasks. The third task asks me to compare two cards: card1 and card2. The function should return 1 if card1 is greater than card2, 2 if card2 is greater than card1, or 0 if both cards are…
Adilene
  • 25
  • 1
  • 1
  • 9
-1
votes
1 answer

Multiple Errors Building Deck of Cards

Receiving two errors trying to compile my files. (Received a down vote without an explanation; I fail to see how this violates any SO guidelines.) 1) c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\c++0x_warning.h:32:2: error: #error This file…
StormsEdge
  • 854
  • 2
  • 10
  • 35
-1
votes
3 answers

Is there any benefit in not enum cards c#

I'm going to create a card class in C# for a poker game. All needed actions with cards are going to be implemented in other classes like deck or hand or combination. What type of fields should I use for rank and suit, string or enum or int? Is…
Igor
  • 130
  • 1
  • 6
-1
votes
1 answer

Some bugs in my python war card simulator

Here is the problem I am working on: write a function war() that simulates one game of war and returns a tuple containing the number of battles, wars, and two round wars. For me, the hardest part of writing the function is when there were…
Quino
  • 1
  • 2
  • 5
-1
votes
1 answer

New Deck of cards display in a textbox

private void GetNewDeck_Click(object sender, EventArgs e) { string[] suit = { "C", "D", "H", "S" }; string[] num = { "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A" }; for (int j = 0; j < 4; j++) …
user3648850
  • 19
  • 1
  • 2
  • 4
-2
votes
1 answer

Filling a deck with Cards C#

I am tasked with Creating a functional deck of cards and I need a bit of guidance. I am making my method to fill the deck(an array) with card objects. I have the logic that will tell the loops when to change suits or ranks and I have made it to…
-2
votes
2 answers

getting all the possible permutation of cards between several players

I am trying to get all the possible deals of n cards between 3 players, where each player i need exactly n_i cards and some of the players can not get some of the cards. For example, assume there are 4 cards: Ac,Jh,9d,2s and player N,E,S needs 1,1,2…
Cohensius
  • 385
  • 7
  • 18