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
2 votes
2 answers
74 views

Poker hand valuator in Python

As you will probably notice very quickly from the code below, I'm not very experienced coder. Below is my attempt at valuating poker hands in Python. The code below may not be pretty but it seems to ...
0 votes
0 answers
43 views

typescript poker filter pairs from 7 card deck

I am making a poker game and poker-evaluator that I am using to tell me only the outcome from the cards ...
1 vote
1 answer
45 views

Simple Blackjack game

This is my simple Blackjack game made in Python. I would love some feedback to write better code. ...
2 votes
1 answer
46 views

Simple BlackJack Card Game - First OOP Code

Blackjack card game with hit and stand. Wasn't allowed to use functions outside of classes in code. Had some difficulty with __str__ dunder method on Dealer and ...
1 vote
2 answers
81 views

Object-Oriented Blackjack V2

[Edited] formatting and Flake8 linter corrections Four days ago I posted my first object oriented programming project. Everything I have learned to date is self-taught and posting project to receive ...
6 votes
4 answers
166 views

Object-Oriented Blackjack

[Edited: added V2 link] BlackJack V2 - Github This is my first post, and I was actually going to post this on Stackoverflow when I was rather suggested posting the code here, as it may be better ...
2 votes
1 answer
67 views

Pick two random cards from a standard deck

I wrote this code as a refactor of code I saw on Programiz. I thought about this refactor before going to bed and implemented it successfully in code. ...
  • 23
5 votes
1 answer
71 views

blackjack dealer hand generator

I wrote a piece of blackjack code - for dealer dealing cards to himself (python). My question is how can I make it more efficient, faster and neater. I ran it for 1.000.000 iterations and it took 14.7 ...
2 votes
1 answer
105 views

Simple Java Solitaire / Patience card game

I made a simple Patience/Solitaire card game. The cards don't use images but JLabels and JPanels. The game is finished when all cards are on their suit piles. Card movement: mousePressed : card -> ...
  • 53
1 vote
2 answers
89 views

A card game deck/hand manager

I started writing a card game in C++ yesterday, just as something to do to familiarize myself with the language. When I showed it to a friend of mine in the compsci field he said I should share it ...
  • 11
3 votes
2 answers
205 views

Card game using OOP

I already know that I shouldn't really use the global function and that how I judge who wins is also really inefficient so I would appreciate improvements for that. I watched a tutorial about Object ...
  • 31
4 votes
1 answer
213 views

Python blackjack code

Code below, very new to python, would love some constructive criticism, mainly in relation to what I could have improved on, if my use of aces (where I subtract 10) is smart, and my use of functions? ...
  • 41
3 votes
0 answers
59 views

Blackjack Python Code Feedback

Been working with python for a couple years on the side, looking to get feedback on this Blackjack game I made for some OOP practice. Code executes as expected (and I know the game is incomplete - no ...
4 votes
1 answer
323 views

Blackjack game in C++

I developed a blackjack game. I am relatively new to c++ and OOP, so I am asking for feedback on what could be improved. This game features betting, taking a card, standing, and splitting a hand. ...
2 votes
0 answers
50 views

simple OOP Blackjack

It has been a long time since I have gotten into OOP with python. I made this short little program. Are there any ways that I can make it more clear or concise (pythonic if you may)? ...
  • 121
3 votes
0 answers
81 views

C++ OOP for BlackJack

BasePlayer.h ...
3 votes
2 answers
242 views

Blackjack implementation - Java

I have inspired from the recent blackjack question here and decide to code for simple blackjack console application Please review and let me know What can improve on the code? Rules for the ...
3 votes
1 answer
124 views

Blackjack game in python w/ bot

I am a beginner programmer and this is my first project, a blackjack game with a functioning dealer in python. Any feedback would be appreciated (especially if its about bot improvement). ...
3 votes
1 answer
202 views

Python Poker Hand Comparison Progam

I recently started learning Python and the first program I've made is a program to determine the best 5 card hand from seven total cards and then to be able to compare two different hands to determine ...
2 votes
1 answer
183 views

C++ Blackjack game (rough version)

Below is the Blackjack program code. How do I make the code look nicer? I feel like the code is super messy and I was wondering how I could make it look better or if there are better ways to write ...
9 votes
1 answer
2k views

Card Shuffle without using any help C#

I'm new to C# but not 100% new to development. I wanted to try writing a Card Shuffle + Card Dealing algorithm using as least as possible inbuilt functions or any libraries and no internet use to ...
  • 101
2 votes
0 answers
102 views

Can we make a worse automatic card shuffling machine?

So I've been droodling on a blackjack project, and one of the issues we need to solve is how to shuffle the cards. I've implemented a method that simulates hand shuffling (E.g split the shoe (either 2,...
1 vote
1 answer
86 views

Java: Using one class or algebraic data types to model different state?

I'm creating a tool to analyze a card game which is played by three players. A Card is associated with a number of points and looks like this: ...
2 votes
0 answers
209 views

OOP Blackjack in Python 3.9.9

I've noticed I'm not the first to post this topic. As a matter of fact, I have taken some inspiration from Victor Nguyen Bao's post to help structure my code. Here's the link to his code: Structured ...
4 votes
2 answers
80 views

Would love some insight on the current state of my Blackjack code

I started coding blackjack from scratch and just finished the basics so I would love some insight. I would really appreciate if any of you could look through it and let me know if there's anything I ...
3 votes
2 answers
127 views

A very basic Black Jack program, which just lets you play one round without any balance or betting

I just wanted to make a fun project for practise and as far as I know the program runs just fine without any flaws, but I would like to add an option to it, if a round ends to ask the user if he wants ...
4 votes
2 answers
663 views

UNO card game with AI players

I had lost a lot of cards of my UNO deck, and was frustrated, and that's when this idea struck my mind. I chose C++, knowing it would be hard, just to improve my understanding of the language. ...
3 votes
1 answer
574 views

Monte Carlo Simulation of 7 Card Stud Poker

I've completed this as part of an online programming course (in which code review is supposed to be done by fellow learners, but it's been a very long time and none of them have reviewed this), and ...
  • 33
1 vote
2 answers
209 views

Card deck for Blackjack in an OOP style [closed]

So far I have made a class called Deck, to create and shuffle a deck of cards, and a class called Player, which I want to use to create the gambler and the dealer. My Player class inherits from the ...
  • 23
6 votes
2 answers
266 views

ASCII-based OOP blackjack game in Python

I'm new to programming and have been teaching myself to code for about 6 months. Since I have no one to ask about any of coding-related questions, I may have developed bad habits in the meantime, but ...
  • 128
4 votes
2 answers
550 views

War card game with random play

I'm trying to learn C++ with a background in python. This is my first program besides general practice. I wanted to remake the war game. I'm looking to get feedback on the C++ equivalent of its ...
5 votes
3 answers
582 views

Text Based Blackjack

I wanted to make a blackjack game to use while bored, but it turned out to be far more complicated than I thought. ...
  • 802
4 votes
1 answer
98 views

Deal and evaluate a Bridge hand

I am building a little helper for the card game Bridge. The aim is to generate a "hand" of 13 randomly-dealt cards, and then to run various calculations on the hand to help a player with the ...
3 votes
1 answer
799 views

A versatile deck of playing cards. Standard 52-card deck and more

I have seen many posts regarding a standard 52-card deck of playing cards. I recently was composing an answer to one such post when I realized my answer should be its own post since (A) the answer ...
  • 5,772
2 votes
1 answer
97 views

Main loop for a text-based Blackjack game

Is there any way to reduce this code? It repeats itself, but I cannot find any way to reduce it because it is only repeating inside one elif. Sorry I'm a beginner my code is quite bad It repeats here: ...
3 votes
1 answer
235 views

Poker Hand Evaluation (speed optimization)

Given a two-card poker hand and a board of 5 cards, I want to evaluate the player's hand strength as listed here. The evaluation of a poker hand was measured to be ~100 microseconds on average. ...
7 votes
1 answer
1k views

Blackjack game in Java

So this is a blackjack game, any feedback or tips on what I should remove from the code that is not needed is very appreciated. Note: some of the names of classes or variables are in Swedish but it ...
  • 105
9 votes
1 answer
12k views

Deck of Cards written in C++

I created a deck of cards that I used in a BlackJack game. I stripped out my black jack logic and left just the Deck, card and minimum dealer. The deck class is there because I want to create ...
2 votes
2 answers
603 views

Blackjack script in Python

Recently I had a python test and, unfortunately, I failed. I'm going to re-do my test and the teacher gave me the tip to work more efficiently and clean. To practice this I made a blackjack game about ...
8 votes
3 answers
2k views

C# Blackjack prototype

I would like some feedback on my code, I'm new to coding with C# but I do have some knowledge on Lua and Python. Is there anything that I need to change/clean up to make it more simplified? ...
  • 91
4 votes
2 answers
357 views

Three Card Monte game using Java

I made a Three Monte Card game using Java Problem: This is the original "ball and cups" game where you try to find out which cup has the ball under it. You may play with three cups and a ...
user avatar
3 votes
1 answer
75 views

follow up: Blackjack with card representation visuals

This is a follow-up to my original post of Blackjack with card representation visuals I was given some very helpful advice by @Reinderien and @Linny which I greatly appreciate. I have done my best to ...
14 votes
2 answers
1k views

Blackjack with card representation visuals

To try and practice OOP, I've heard making a blackjack game can be really helpful; which it has been. I don't know how 'advanced' an implementation this is; but it has all the standard features, like ...
2 votes
0 answers
80 views

Project Euler Problem 54 poker hands in OCaml

I've been refactoring my OCaml solution for Project Euler problem 54, which is about comparing poker hands. While I'm mostly satisfied with my second iteration of the refactor, I stumbled upon two ...
  • 151
4 votes
1 answer
502 views

Design a simple card game in JavaScript

I wrote a simple card game in JavaScript and I wonder if anyone could give me some advice and make some improvements on my code. Here is the demo that I build: https://codesandbox.io/s/cardgame-...
  • 305
2 votes
1 answer
723 views

Create a deck of playing cards & draw a hand of cards

I built a very basic blackjack program a couple of weeks ago, but I've learned a lot since then, and would like some input on a couple of basic functions for card games: a build_deck function and a ...
  • 331
0 votes
1 answer
70 views

My first code - looking for feedback on best practices and things I should avoid doing in the future

After just learning a bit of Python I tried coding something myself. I attempted to do a game of Blackjack, which is far from perfect, and still doesn't have some rules a real game has (in my game an ...
6 votes
3 answers
154 views

Compute the value of a hand at contract bridge for every possible hand

Background At contract bridge, each player gets a hand of 13 cards from a deck of 52 cards. To evaluate the potential of a hand, we need to calculate what we called the High Card Points (HCP) of it. ...
  • 235
5 votes
1 answer
150 views

Simplified Blackjack in Python

I just started learning python a couple of weeks back from and like many others here, I too seek feedback on my simplified Blackjack game. I would like to know if the code could have been more elegant/...
8 votes
2 answers
465 views

My third game - Poker hand strength analyzer

I'm writting this poker hand evaluator and it's really coming along. But, as you can see I repeat myself many times and I would love to know what's your thought process when you're repeating yourself? ...

1
2 3 4 5
8