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).

Filter by
Sorted by
Tagged with
31 votes
20 answers
3k 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 ...
DJMcMayhem's user avatar
  • 59.2k
10 votes
5 answers
760 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 ...
Todd Lehman's user avatar
  • 1,819
72 votes
48 answers
9k 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 (...
Martin Ender's user avatar
-10 votes
1 answer
390 views

Bingo Cards PDF

Write code to generate a PDF file containing 6 bingo cards. Winner is the one that uses the shortest code and needs no actions except for installing a library and running the code. (No Save As PDF). ...
paki eng's user avatar
  • 175
50 votes
12 answers
9k 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 ...
Stewie Griffin's user avatar
32 votes
11 answers
2k views

Nothing like a good ol' game of ModTen

Disclaimer: ModTen is a fictional card game which was created for the sole purpose of this challenge. The rules of ModTen ModTen is played with a standard 52-card deck. Because the full rules are ...
Arnauld's user avatar
  • 192k
31 votes
1 answer
2k 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 ...
isaacg's user avatar
  • 42k
25 votes
8 answers
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 ...
DJMcMayhem's user avatar
  • 59.2k
22 votes
13 answers
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 ...
user avatar
22 votes
2 answers
834 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}, ...
Rainbolt's user avatar
  • 6,376
19 votes
14 answers
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 ...
Wheat Wizard's user avatar
  • 98.5k
18 votes
2 answers
573 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 ...
Wheat Wizard's user avatar
  • 98.5k
15 votes
13 answers
4k views

Execute a Superb Shuffle™

For the purposes of this question, a deck of cards is formatted in this way: ...
AJFaraday's user avatar
  • 11.8k
14 votes
3 answers
984 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 Jokers)...
Kevin Cruijssen's user avatar
13 votes
1 answer
719 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. ...
Nathan Merrill's user avatar
12 votes
7 answers
429 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 ...
a spaghetto's user avatar
  • 11.2k
11 votes
8 answers
781 views

Score counter for Skat

You task is to write a small program, that counts the points of a Skat hand. A Skat deck has cards 7 to 10, Jack, Queen, King and Ace (called Unter, Ober, König and Daus). We use the German suits, ...
FUZxxl's user avatar
  • 10.1k
11 votes
4 answers
544 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 ...
IanF1's user avatar
  • 212
8 votes
4 answers
1k 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, ...
lessharm's user avatar
2 votes
0 answers
70 views

Play the card game "Set" [duplicate]

"Set" is a card game played with a deck of 81 cards, twelve of which are pictured below: Each card has four attributes, each of which may assume three values: Number: the number of symbols, either 1,...
jnfnt's user avatar
  • 383