The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [playing-cards]

Programming questions involving digitally-represented playing cards. This includes representing cards and decks in data structures, user interfaces for manipulating cards in a virtual fashion, and implementing correct algorithmic shuffling.

Filter by
Sorted by
Tagged with
4
votes
1answer
1k views

Second attempt at a Blackjack game

I posted yesterday about my first attempt at a Blackjack game. After I received much helpful advice I tried my best to fix up my code. I was wondering what you would think about round two! Edit: I ...
9
votes
3answers
37k views

First attempt at a Java Blackjack game

I just completed my first multi class program, Blackjack, and it works! It allows the user to play Blackjack against a single dealer, with no other players at the table. I was wondering, seeing as it ...
4
votes
1answer
354 views

Card arithmetic game

There was a task on Stack Overflow which quite obviously was too broad (it didn't have a solution provided or anything!) which was the following: Give an object oriented design for a game that has ...
15
votes
1answer
1k views

Go Fish game written in Go

A couple months back I made a go fish game in Go, just for the sake of that pun. It was pretty poorly done and made experienced Go-ers cry when they looked at it. I rewrote some of it to be more ...
6
votes
4answers
1k views

Console Card Game - Contract Bridge

My project has three classes: Card, Deck, and BridgeConsole. The ...
7
votes
3answers
8k views

Texas Hold em Poker Hand recognition algorithm and implementation

I am designing an in-depth poker game. I am first focusing on recognizing the strength of a hand given the set of cards. Is the following algorithm suitable for the stated purpose? Am I using correct ...
0
votes
1answer
374 views

Function for shuffling cards

Assignment from here Q6. Define a function shuffle that takes a list with an even number of elements (cards) and creates a new list that interleaves the elements of the first half with the elements ...
5
votes
1answer
1k views

Poker Odds Calculation with Monte Carlo

I have created an Odds Calculator in Java. The program gives me the odds, but I want to make sure that they are correct. Maybe someone can tell me a calculator I can compare my results with or knows ...
2
votes
1answer
225 views

Recognising and comparing poker hands

I wrote a little program that recognises poker hand combinations and compares hands if the ranks of both hands are the same. I had tested my program on possible combinations for each rank and the ...
10
votes
3answers
7k views

Bridge Card Game

So I'm in the process of creating a simple Contract Bridge in Java. I will be using JavaFX to create the GUI component of the program. For right now I am trying to tackle writing each of the classes ...
12
votes
2answers
2k views

Determining winning hand in poker

After having reviewed this question, I recalled that I haven't solved Project Euler's problem 54. So I did it, however, I fount out that implementing the exact rules is rather tricky. So I ...
6
votes
1answer
3k views

Determining winner and winning hand in poker (holdem)

I wrote couple classes that calculate winner, winning hand and winning hands rank (straight, flush, fullhouse etc.). I searched for something similar, but only found posts where five cards are used, ...
3
votes
1answer
97 views

C++ port of my Ruby narcotic solitaire simulator

Having undergone a little "rediscovery" of C++, I decided to port my Ruby narcotic solitaire simulator program to it. My goal here is efficiency. This program is already about 5 times faster than the ...
2
votes
2answers
3k views

War card game simulator

My teacher wants us to create a program that runs n games of war and calculates the average number of battles, wars and double wars that occurred. He has very specific rules (not necessarily the ...
5
votes
1answer
8k views

Implement Blackjack in Python with OOP

I feel the best way to learn is practice. I have written a simple Blackjack game in Python which supports multiple-players and functionality like Hit, Stand, Surrender, Split and Double_Down. I need ...
3
votes
1answer
138 views

Pitting two Blackjack bots against each other

I'm taking part in this Daily Challenge on http://www.reddit.com/r/dailyprogrammer/comments/29zut0/772014_challenge_170_easy_blackjack_checker/ Basically, you have to develop a program that runs two ...
4
votes
1answer
4k views

OOP Blackjack game

I made this Blackjack game to help me learn the syntax of JavaScript classes and objects. As I was writing the game I felt like I was misusing the idea of OOP. By that I mean I felt like some of the ...
3
votes
1answer
2k views

Drawing tarot cards

The goal is to draw random tarot cards from the suit, number of cards is determined by the amount of HTML elements with 'card-container' class on given page. The deck is structured as follows: ...
11
votes
2answers
11k views

ASCII-fication of playing cards

I am making a small Blackjack game in Python 3. The part of the code I am unsure about is that which allows me to print nice ASCII versions of the card. ...
12
votes
1answer
664 views

Project Euler #54 - Poker Streams

This challenge posted by Durron597 intrigued me, and inspired me to answer his question, and also to determine whether a more functional approach was available for poker hand ranking. The problem ...
4
votes
1answer
359 views

Project Euler #54 solution - follow-up

This is my second solution to Project Euler #54. You can find the original post here. Brief problem summary: The file, poker.txt, contains one-thousand random hands dealt to two players. Each line ...
9
votes
2answers
3k views

Project Euler #54 Solution

This is not the latest question in iterative code review of this program. You can find the latest answer here. Here's my solution to Project Euler #54. Click the link for the full project description ...
6
votes
3answers
815 views

Is the way I'm handling deck (card) generation the wisest way to do it?

My Deck Class: (In case it isn't clear, a Card is just an object with two enums, one for suit and one for value). I'm ...
7
votes
4answers
8k views

Basic playing card generation and shuffle

This is my first attempt at Java so I appreciate any criticism or pointers. The program should generate a full set of given decks and then shuffle them. ...
3
votes
3answers
1k views

Blackjack odds calculator

I'm working on getting switch and if statements down and I came up with this. It works well and I don't have any problems with it running properly. I was wondering if I could get some feedback on ...
5
votes
2answers
9k views

OOP Blackjack in C++

I finished my Blackjack OO game and I'd like to get my OO skills reviewed. ...
5
votes
1answer
1k views

OO Blackjack game design

I have set up card, deck, hand, player, ...
7
votes
2answers
4k views

Hand rankings for Poker game

I have tried to write a small part of a Poker game to check the Poker hand rankings. Please review and provide your feedback. ...
3
votes
1answer
283 views

Ruby program to simulate a game of Narcotic Solitaire

In the game of Narcotic Solitaire, played with a standard 52-card deck, the player deals a row of four cards onto the table, from left to right. If all four cards are of the same value, they are ...
12
votes
7answers
1k views

Beginning Blackjack program

I am fairly new to this, so please tell me whether this is a good way to write code or if I'm missing anything. ...
4
votes
3answers
5k views

Generating playing cards

This code has several functions and procedures for the program to generate cards like '5 of diamond'. I would like to shorten the code. ...
8
votes
3answers
246 views

Better card validity check in JS card game

I am writing a card game in Javascript. The game is played with a 32 card deck. When a card is selected to be played by a user, i do a validity check on the server to check whether it matches the ...
11
votes
1answer
10k views

Simple Poker Game

I'm building a simple Poker game. It is almost complete, but I want to refactor it early. To calculate hand strength / ranks, I use this library from NPM: poker-evaluator For deck shuffling, I use ...
14
votes
2answers
4k views

Let's play some Swift Poker

Before you can do any sort of card game, you must first write some code to define your deck of cards. One thing I've noticed in looking at some of Apple's Swift interfaces is that they very much so ...
2
votes
2answers
21k views

Simple deck of cards

I had recently completed one programming challenge where I've had to design a deck of cards. The time was limited but I tried my best. I designed the basic operations and am wondering if I can improve ...
15
votes
4answers
19k views

Text-based BlackJack game

I am a new programmer (I've been doing Java for about 7 weeks) and I am of the type who wants to get it right straight away, so I wonder how this code: Compares to the common practice is structured. ...
4
votes
2answers
7k views

Object-oriented Blackjack game

I know some things are a bit over the top (such as the hashmap use, but it was needed to use some sort of collection class) - but are there anything else that sticks out as a sore thumb in my code? I'...
9
votes
6answers
2k views

Blackjack on console

I have decided to create a console Blackjack game as my final Java project. Please take a look at my code and give me some feedback. I have tried to make the game as object-oriented as possible. I ...
27
votes
7answers
26k views

Basic OOP Poker - Deck, Cards and Hands

I decided it would be interesting to simulate a game of Poker. Baby steps at the moment, and eventually I'll attempt to turn it into a GUI. The code I have so far is very basic such as populating a ...
15
votes
2answers
1k views

Using large amounts of if-else statements for playing card numbers

I have a method that uses a bunch of if-else statements, and I am thinking how I could simplify it. ...
4
votes
4answers
617 views

Refactoring huge if..elif in __init__ how?

I have this huge __init__ method which I want to clean up even more after watching Clean Coders videos (content of Clean Code book by Robert Cecil Martin). How ...
12
votes
1answer
6k views

Optimizing “Poker hands” challenge solution

I'm trying to solve the project Euler problem 54. In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way: High Card: Highest ...
10
votes
3answers
28k views

Console Blackjack game

What do you think the weak points are and how can I improve? I thought I could really use a Hand class in the dealHand method. ...
6
votes
2answers
979 views

Abstract card game code in Python3

I've written up some generic code for a card-game and would like to hear any and all suggestions for how to improve this code further, in any way shape or form. The code is on github or pasted ...
4
votes
1answer
294 views

Counting the total value of Card instances given

I am trying to write a function called countHand() that takes in an array of Card instances and counts the total value of the ...
5
votes
2answers
7k views

Blackjack game with classes instead of functions [closed]

To try out the concepts and tools I've been learning, I decided to write a Blackjack game. I wrote it entirely with functions, so it hasn't helped me at all with the concept I really lack ...
19
votes
1answer
2k views

Blackjack Strategy

I am creating a Blackjack simulator in Java in order to better understand the language. I have written the basic strategy section for a player and it is terribly long. Is there a better way to do ...
8
votes
3answers
37k views

Text-based Blackjack game in Python

I am new to programming in Python and wrote a simple Blackjack project. I am looking for experienced peers to provide a high level code review about the overall design patterns and proper usages. The ...
-1
votes
1answer
47 views

Touched events created in a for loop [closed]

All I want is a simple "yes/possible" or "no/and that's bad coding". I have a card game I'm making and looking through your discard pile is a big part of it, so it's going to be constantly growing. ...
6
votes
1answer
2k views

First text game with Python - Higher or Lower

Recently I have been learning Python programming, for about a week. I have covered all basic stuff - loops, strings, input masks - and have challenged myself by making a little game. It isn't much, ...