Claude Game Studio

How to make a card game

To make a card game, write the deal and the rule that decides a turn, draw a card back and a card face, then flip two cards and check them. This guide builds Orchard Pairs, a sixteen-card matching game, from the kit's puzzle starter, and you can play it below.

Click or tap a card to turn it. Arrow keys move and Space turns, too.

Play in a full tabDownload gameNotices
5.3 min
from the prompt to a passing playtest
31 of 31
playtest checks passed
12.4
average turns for a player who remembers every card
24
turns allowed to find all eight pairs

1. Pick a card game you can finish

You choose a game whose rules fit in one sentence. Orchard Pairs is the matching game that many players know as Concentration: sixteen cards lie face down, you turn two, a pair stays up, a miss turns back, and you win when all eight pairs are up. Wikipedia's entry on Concentration describes the same turn-and-match rule, played there with a 52-card deck, which makes it easy to check that this game does what the name says.

Games with hands, bidding or several players need a lot more rules before anything is playable. If you want a physical deck to print instead, The Game Crafter's getting started guide covers uploading card images and ordering a deck. Start with one deck, one table and one player. Everything the kit supplies for a puzzle game still applies: the input handling, the title and end screens, the particles and the sound. You replace the rules and the pictures.

2. Copy the puzzle starter and say what changes

You start from the nearest game and rewrite its rules. The kit's puzzle starter is a match-three called Glowtide, which already has a board, a cursor, mouse and touch input and a bot. A card game is not a match-three, so the prompt names what to keep and what to replace. We gave Claude Code this prompt on 21 November 2026:

Use the puzzle starter to make a small card game called Orchard Pairs: a 4 by 4 grid of face-down cards, turn two at a time, clear all eight fruit pairs in 24 turns or fewer. Keep the starter's input, screens, effects and sound; replace the match-three rules with a pairs game and redraw the pieces as cards. Build it, run the playtest, and fix anything that fails.

The kit's receipt command stamped the run at 18:40:33 UTC for setup, 18:44:10 for first play and 18:45:53 for a passing playtest: 5.3 minutes, as written in the receipts file. That includes reading the starter's code and writing the new files. One repair stamp follows at 19:07 UTC: a review found the title card hard to read over the cards, so its background was darkened and the playtest passed again. Claude usage was not priced for this run, so there is no dollar figure.

npm run new -- orchard-pairs --from=starters/puzzle npm run build -- --game=games/orchard-pairs
The five game files, their length in the starter and in Orchard Pairs, and what changed
FileStarter linesOrchard Pairs linesWhat changed
board.js13738The rules with no drawing. Match-three scans for lines; this one deals, checks a pair and picks the bot's next card.
game.js554377Animation, input, the turn phases, the bot and the end of the round. Swapping and falling pieces became flipping cards.
art.js362314Six sea creatures became eight fruit cards, a card back, a felt table and a night orchard.
config.js3636Board size, kinds and palette: a 4 by 4 table, eight fruits and 24 turns.
hud.js3837A ring for pairs found and a count of turns left.

The engine glue in src/kit/ stays as it is. That is why a game with a new rule set still passes the starter's checks for boot, audio, touch and a file opened with no server.

3. Write the rules without drawing anything

You put the deal and the pair check in plain functions. The starter keeps its rules in board.js with no drawing, so a bot and a test can use them. Orchard Pairs' version is 38 lines. It deals two of each fruit and shuffles them with a Fisher-Yates shuffle, where every order of the sixteen cards is equally likely.

Keep the check strict: a card cannot pair with itself, and two different cards pair only when their kinds are equal. The same file holds the bot's choice, which turns a card it has never seen, or the known partner of the card it just turned.

export function deal(pairs, rand) { const cards = []; for (let k = 0; k < pairs; k++) cards.push(k, k); // two of each fruit for (let i = cards.length - 1; i > 0; i--) { // Fisher-Yates shuffle const j = Math.floor(rand() * (i + 1)); [cards[i], cards[j]] = [cards[j], cards[i]]; } return cards; } export const isPair = (cards, a, b) => a !== b && cards[a] === cards[b];

4. Draw the cards in code and flip them

You paint a back and eight faces, then flip by squeezing the card. Every picture is drawn on a canvas in art.js: a cream card with a colored inner border and a fruit for each face, and one green card back with a gold lattice. There are no image files. A card turns over by shrinking its width to zero as the angle of the turn passes 90 degrees, then growing it back showing the other side.

The cursor ring, glow and spark effects are the starter's, redrawn for cards. Look at the frames the kit captured: the dealt table, a matched pair and a miss before it turns back. If a face reads poorly at phone size, fix the picture before you add a feature.

5. Give each turn five phases

The five phases of a turn
PhaseWhat the game is doing
idleWaiting for a card. Click, tap or Space turns the card under the cursor.
judgeTwo cards are up. After the flip finishes, they are compared.
showA miss. Both stay face up for 0.85 seconds so the player can learn them.
unflipA miss turns back. Only then does the next turn start.
clearA pair. Both glow, burst and stay face up for the rest of the round.

You let only one phase accept a card. Input is ignored unless the phase is idle, so a fast second click cannot turn a third card while two are being judged. A turn is counted when the second card goes up, and the round ends when all eight pairs are found or the 24 turns are spent.

The playtest clicked a card that was already face up and checked that nothing happened, then turned a second card and checked that exactly one turn was spent. Those two checks catch the bugs card games usually ship with.

6. Test the difficulty with a bot

Average turns to find all eight pairsRemembers every card12.4Forgets everything64.3the 24-turn limit
Each bar averages 20,000 seeded deals. The player who remembers never needed more than 15 turns. The forgetful one finished inside 24 turns on 1.7% of deals. Read the simulation result.

You pick the turn limit from a measurement. We ran 20,000 seeded deals of this table with two simulated players. One remembers every card it has seen. The other forgets everything and turns two random cards each turn. The first averaged 12.4 turns and never needed more than 15. The second averaged 64.26 turns and finished inside 24 on 1.7% of deals.

A person sits between the two, so 24 turns is generous, yet the game still rewards paying attention. The kit's playtest then let the remembering bot play a real round: it won with all 8 pairs in 17.4 seconds of real time and the full list passed. Read the report or the run record. The kit is $29 a year on the pricing page, with Claude access billed separately.

Questions

How do I make a card game?

Write the deal and the one rule that wins or loses, draw a card back and a card face, and let one turn flip cards and check them. A matching game is a good first card game because its rules fit in one sentence. Build the rules first, then the drawing.

How do you shuffle cards in code?

Use the Fisher-Yates shuffle: walk from the last card to the second, swap each card with a random card at or before it, and every order is equally likely. Orchard Pairs deals sixteen cards, two of each of eight fruits, and shuffles them this way.

How many turns should a matching game allow?

Test it with a bot before you pick a number. A player who remembers every card needs 12.4 turns on average for eight pairs, and one who forgets everything needs 64.26. Orchard Pairs allows 24, which a careful human can reach and a guesser almost never can.

Can Claude Code make a card game?

Yes, when it starts from a working game. We gave Claude Code the puzzle starter and one prompt, and it produced a playable sixteen-card game that passed 31 of 31 playtest checks in 5.3 minutes. It still needs your eyes: play the result before you trust it.