Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [card-games]

For challenges which involve card games. This includes playing the game, implementing the game, as well as challenges concerned with individual mechanics and analysis of the game (for instance, computing probabilities of certain events).

1
vote
2answers
128 views

Accordion Solitaire: Which First Moves Can I Make?

Introduction: Unfortunately an Accordion Solitaire Solver challenge already exists (Solve a game of Accordion), so instead this easier related challenge. Let's start by explaining how Accordion ...
6
votes
3answers
175 views

Scoring Chinese Hearts

Chinese Hearts, also known as Gong Zhu (拱猪, Chase the Pig), is a variance of the Hearts game. It is a 4 player card game with the aim to earn the highest amount of points. You may read more about it ...
3
votes
4answers
401 views

Russian BS - Submissions accepted until October 13th

The ChatRoom is here I love playing the card game BS, but sometimes, it just doesn't have enough oomph for my short attention span. Instead, let's play some Russian BS. Rules Here is a quick guide ...
3
votes
6answers
356 views

Let's Play some ProSet! [duplicate]

ProSet is a classic card game that is played normally with 63 cards. One card has 6 colored dots on it, like below The rest of the cards are missing some of these 6 dots, but each card has at least 1 ...
1
vote
2answers
179 views

Bridge Deal Scoring

Goal Given a deal result from Duplicate Contract Bridge, calculate the deal score. Basically the same as iBug's question, which was deleted. I figured out this scoring system while trying to answer ...
11
votes
13answers
660 views

Scoring Briscola

Introduction Briscola is one of Italy's most popular card games. It is a trick-taking card game, like Bridge. Briscola is well known for its bizarre point system. In this challenge, given two cards, ...
37
votes
7answers
7k views

Professor at MIT can read minds!

The task is taken from an MIT lecture by Prof. Devadas called You can read minds. A detailed explanation of the trick can be found in the linked video, or in this document. I'll try to explain it in ...
11
votes
7answers
710 views

Blackjack Bust Calculator

Blackjack, also known as twenty-one, is a comparing card game between yourself and a dealer, where each player in turn competes against the dealer, but players do not play against each other. Play ...
16
votes
11answers
2k views

Want to see a Magic Card Trick?

The first magic card trick I ever learned as a child was the following: Have 1 deck of cards where the pattern on the back is not vertically symmetric. Organize all cards to be facing one direction. ...
5
votes
3answers
617 views

Wanna See a Card Trick? (Part I)

Amazingly, this is the easier of the three card tricks I know off the top of my head... The aim of this is to have your compiler perform a specific card trick. There's no slight of hand, and the ...
4
votes
0answers
58 views

Cribbage Scoring [duplicate]

My brothers and I like to play Cribbage. Now, the scoring rules for Cribbage are somewhat complicated, and I often worry that I'm not counting my score correctly. Therefore, your job is to write a ...
19
votes
13answers
2k views

Is it a shuffle?

Yesterday I asked this question about riffle shuffles. It seems that yesterdays question was a bit too hard so this question is a related but much easier task. Today you are asked to determine if a ...
18
votes
2answers
450 views

How many shuffles

A riffle shuffle is a type of shuffle where the deck is split into two partitions and the partitions are then spliced back together to create a new shuffled deck. The cards are spliced together in ...
19
votes
9answers
728 views

Hand patterns in a card game

A deck of cards is the Cartesian product of S suits and R ranks. Many, though not all, card games use ...
13
votes
10answers
633 views

Deal an ASCII Deck

There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards: ...
9
votes
4answers
369 views

Badugi, Who Wins?

Inspired by this challenge and related to this one. Background Badugi [bæduːɡiː] is a low-ball draw-poker variant. The Pokerstars World Cup Of Online Poker $1K event starts within 3 hours and I'll ...
8
votes
4answers
320 views

1326 starting hold'em combos

The goal is to get all combinations of hold'em starting hands (every two card combination) in the shortest amount of code. A hold'em hand is two distinct cards dealt from a standard deck of 52 cards, ...
8
votes
6answers
1k views

Dungeon of botdom

– of crisis and martyrdom (that's the subtitle because subtitles are cool) In this king-of-the-hill challenge in python (yup; you need go no farther to know you may not submit in java), you need to ...
64
votes
45answers
8k views

Magic the Gathering: Friends or Foes?

In the card game Magic: the Gathering there are five different colours, which represent loose affiliations of cards, White (W), Blue (...
11
votes
4answers
484 views

Name the Brag Hand

Background Brag is a card game similar in concept to, but simpler than, poker. A hand in brag consists of three cards and is ranked as follows from highest to lowest: Three of a kind - all three ...
21
votes
10answers
1k views

How many Blackjack sequences in that list?

Your task is to find how many distinct Blackjack sequences can be found in an ordered list of 12 cards. A Blackjack sequence is defined as a sequence of consecutive cards whose sum of points is ...
18
votes
1answer
600 views

Hold'em or Fold'em?

Your friend invited you to a high-stakes poker game at the last minute and, as a computer scientist, you've decided to use your skills to gain an edge on the game. Your task will be, given ...
2
votes
0answers
62 views

Score a hand of Cribbage! [duplicate]

Goal: Given a hand of 5 cards, determine its value in the game Cribbage. Input a string through any reasonable means. You can assume the string will always be in this format: ...
29
votes
3answers
664 views

Choose the last card in a poker hand

Poker hands are ranked from best to worst as follows: Straight flush - five cards of sequential rank, all of the same suit Four of a kind - four cards of the same rank and one card of another rank ...
9
votes
0answers
157 views

Play Best Card in Euchre

Input: Firstly An array of three cards representing the cards played by each player formatted like [JD][TH][9S] Representing ...
22
votes
12answers
2k views

Score a hand of Hearts

Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score ...
7
votes
0answers
250 views

Code Golf: BlackJack - best moves

The Challenge I was looking into small code examples for a specific language as a small tutorial and came accross a simplified Blackjack that should be implemented. In this Challenge you will have to ...
14
votes
4answers
526 views

Help me cheat at Cheat

Cheat is a card game where you're trying to get rid of your hand. A turn looks something roughly like this: Determine what card rank you have to play that turn. In most variants this is one rank ...
15
votes
18answers
734 views

Shuffle Up and Deal!

It is Friday and I am tired, so let's do a quick one! Take no input, however you should output all thirteen different numbered cards in a standard deck of cards. You should output 2 through Ace (Suit ...
6
votes
7answers
426 views

Golf me a card dealer

Frank has been working IT his whole life. Each day he responds to tickets, organizes equipment, and reports to his boss. One day, near the closing time on friday, Frank is doing his final inventory ...
13
votes
4answers
702 views

Leo's Pokerface

Pokerface Introduction Leo enjoys playing poker, but his job at Tech Inc. is too demanding for him to learn how to play well. Leo, being a computer scientist, is not discouraged. He decides to take ...
12
votes
5answers
404 views

Display a cribbage score in ASCII

Cribbage is an interesting game, because you need a specific board to score your game. A cribbage board looks like this: Notice how the first column is on the left as it goes up, then on the right ...
19
votes
4answers
624 views

Determine the winner of a game of War

The card game War is interesting in that the final outcome is entirely determined by the initial arrangement of the deck, so long as certain rules are followed for the order in which cards are picked ...
27
votes
18answers
2k views

Faro shuffle an array

A Faro shuffle is a technique frequently used by magicians to "shuffle" a deck. To perform a Faro shuffle you first cut the deck into 2 equal halves then you interleave the two halves. For example <...
15
votes
3answers
778 views

Simulate a 'battle' in the playing card game 'Oorlog'

Let's build a simulation for an aspect in the card game, which I personally know by the Dutch name 'Oorlog' (translates to 'War'). How does 'Oorlog' work? Two decks of cards (each including two ...
25
votes
8answers
2k views

Golf a golf-scorer

As a kid, I used to play the card game "golf" a lot. Your challenge, should you choose to accept it, is to calculate the score of a golf hand. Since there are over 9000 variations on this card game1, ...
12
votes
6answers
315 views

Bridge Hand Scoring

One of the things that makes contract bridge very interesting is its highly complicated "artificial" meta game. This system of scoring hands is a small part of it. Bridge is a trick-taking card game. ...
14
votes
6answers
1k views

Clock (card game)

Clock is an interesting card game, as it requires no skill. It is a single player game, and the same card configuration always leads to a win or a loss. In this challenge, you need to figure out ...
8
votes
4answers
293 views

Calculate Doppelkopf Score

Introduction Doppelkopf is a traditional German card game for 4 players. The deck consists of 48 cards (9, 10, Jack, Queen, King, Ace of each suit while every card is in the game twice), so each ...
17
votes
3answers
424 views

Evaluate a Skat-Hand

Introduction Skat is a traditional German card game for 3 players. The deck consists of 32 cards: Ace, King, Queen, Jack, 10, 9, 8, 7 in all 4 suits (Clubs, Spades, Hearts, Diamonds). In every round ...
11
votes
2answers
170 views

Counting icons for Innovation splays

Innovation is a card game where players battle through the ages, from prehistory to modern times, in an attempt to earn achievements faster than their opponents. Each card in Innovation is unique, ...
10
votes
3answers
875 views

Euchre bots (card game)

The idea of this challenge is simple: create a bot to play the card game Euchre. For those of you who don't already know them, I've written out the rules to Euchre here as they pertain to this ...
11
votes
1answer
463 views

Solve a game of Accordion

Accordion is a solitaire card game I recently came across where nearly every layout is solvable, but incredibly hard. You can play it here. Rules 52 face cards are placed face-up in a random order. ...
22
votes
0answers
1k views

Magic: the Gathering Combat Golf

Magic: the Gathering is a trading card game where, among other things, players play cards representing creatures, which can then attack the other player, or defend against the other player's attacks ...
10
votes
5answers
582 views

Cycle lengths for Perfect shuffles of decks of any size

Challenge In the shortest amount of code: Compute the length of the permutation cycle of a perfect shuffle on a deck of cards of any size n (where n ≥ 2 and n is even). Output a table of all cycle ...
7
votes
2answers
267 views

Probability to clear the board or win

In the game Hearthstone there is a playing board containing friendly and enemy minions, and two heroes - yours and the enemy's. To generalize and simplify, we will assume it's your turn, the opponent ...
13
votes
3answers
374 views

Analyze overhanded shuffles

Rod is moderating a card game between two players: George and Tim. Currently, Tim is shuffling the cards. Rod suspects that Tim is trying to cheat, so he needs your help to check that the shuffle is ...
10
votes
7answers
921 views

Simple Pazaak (Star Wars Card Game from Knights of the Old Republic)

Pazaak is a card game from the Star Wars universe. It is similar to BlackJack, with two players pitted against each other trying to reach a total of twenty without going over. Each player has a "side ...
20
votes
9answers
2k views

Identify halves of Poker cards

A casino uses the following deck of cards. (* is one of the card suits D, S, ...
22
votes
2answers
726 views

Can you cast the spell?

In Magic: the Gathering, mages (known as "planeswalkers") battle each other by casting spells. Spells cost mana. Five colors of mana exist: White, Blue, Black, Red, and Green, represented as {W}, {U}, ...