Playing gin rummy well against the computer
Gin Rummy is a two-player card game about building sets and runs while keeping your deadwood low. This guide covers the rules as the game plays them, the controls, and the strategy that separates lucky wins from consistent ones.

The shape of a hand
Each player holds ten cards. A standard 52-card deck is dealt, ten to you and ten to the opponent. One card is turned face up to start the discard pile, and the rest become the stock.
Your goal is to arrange your hand into melds. A set is three or four cards of the same rank, such as three sevens. A run is three or more cards in sequence in the same suit, such as the four, five, and six of hearts. Any card not in a meld is called deadwood, and each piece of deadwood costs you its face value. Picture cards cost ten, numbered cards cost their number, and an ace costs one.
You win a hand by knocking when your deadwood total is ten or less. If you knock with zero deadwood, that is called gin.
How a turn works
On your turn you must first take a card. You have two choices: draw the top card from the stock or take the face-up card from the discard pile. Then you must throw one card away by tapping it in your hand. That card goes on top of the discard pile, face up, and your turn ends.
After you throw, the opponent takes a turn using the same rules. Play goes back and forth until someone knocks or the stock runs out.
The game shows which of your cards are already in melds by giving them a green edge. That edge updates every time your hand changes, so you can always see your best arrangement at a glance.
Controls on the table
The table is drawn on a canvas. The stock is on the left side of the middle area, and the discard pile is on the right. Tap the stock to draw from it. Tap the discard pile to take the top card. After you draw, tap any card in your hand to throw it away.
A Knock button appears in the controls beneath the board. It is only active when your deadwood is ten or less and you have not drawn yet on this turn. A dropdown labelled Opponent lets you choose between three difficulty levels: Careless, Steady, and Sharp. Press New game to deal a fresh hand.
The stats bar shows your current deadwood total, how many cards are left in the stock, and the knock threshold for the current difficulty.
Scoring and what happens at the end
When you knock, both hands are revealed. The opponent's deadwood is counted the same way as yours. If your deadwood is lower, you score the difference. If you knocked with five and they have twenty-two, you take seventeen points.
But there is a risk. If the opponent's deadwood is equal to or less than yours when you knock, you have been undercut. They take the difference instead. Knocking on nine when the opponent happens to have eight gives them one point and you nothing.
If the stock runs out before anyone knocks, the hand is a draw and nobody scores. Your best result is saved as your lowest deadwood at the time of knocking.
What to throw and when
In the first few turns, throw your highest deadwood cards. A king or queen that is not part of any meld costs ten points. Throwing it early costs almost nothing because you have not invested any turns building around it. Holding it costs ten every turn you keep it.
As the hand develops, your throws become harder. You might hold a seven that could complete a run or a set but has not done either yet. The question is whether the cards you need are still in the deck or already buried in the discard pile. If you have seen two of the eights you need for a set already thrown, that set is unlikely. Throw the seven.
Late in the hand, every card you throw gives the opponent information. If you take from the discard, they know you wanted that rank or that suit. If you throw a five and they are collecting fives, you have handed them a meld. Drawing from the stock is invisible. It costs you the chance of a known card but keeps your plans hidden.
When to knock and when to wait
You can knock as soon as your deadwood is ten or less. But should you? That depends on how much risk you are willing to accept.
Knocking with deadwood of three or less is almost always right. The opponent needs an extremely good hand to undercut you, and holding out for gin risks them knocking first. The reward for gin is bragging rights. The reward for knocking early is actually winning.
Knocking with deadwood of eight, nine, or ten is risky. A steady opponent might already be sitting on seven or less. If they are, you lose the hand you thought you were winning. When your deadwood is close to the threshold, take one more turn. A single draw might turn a risky knock into a safe one.
On the Sharp difficulty the opponent knocks at seven, not ten. That means they will reach knocking range faster than you expect. If you dawdle, they will knock while you are still rearranging.
A card can only be in one meld
The seven of hearts might complete a run of hearts and also be the third seven you need for a set. It cannot do both. The game finds the arrangement of your hand that leaves the least deadwood, and it does that by testing every way to split the melds so no card is shared.
This matters when you are choosing between two possible draws. If both options fill a meld but one of them frees up a second card that was stuck between two overlapping melds, that draw is worth more than it appears. Think about which arrangement leaves the least behind overall, not just which draw completes the next meld.
Reading the discard pile
You can always see the top card of the discard pile. Picking it up tells the opponent what you are collecting, so do it only when the card genuinely helps.
Watch what the opponent throws, too. If they throw a six of spades, they probably do not want spade runs near six and probably do not need sixes for a set. That makes it safer for you to throw a six of clubs, because the opponent is less likely to pick it up.
On the Careless difficulty the opponent does not pay much attention to the discard. On Steady they consider it. On Sharp they weigh it heavily. Adjusting your play to the opponent's level is part of the game.
Common mistakes to avoid
- Holding high cards too long. A king you keep for six turns costs you sixty points of risk. Throw it in turn one and you lose nothing.
- Always taking the discard. It reveals your hand. Draw from the stock unless the discard card is worth the information leak.
- Knocking too early on a high deadwood count. An undercut hands the points to the opponent. Wait for a safer number.
- Ignoring the green edges. The game already shows you which cards are in melds. If a card has no green edge, it is deadwood. Keep track of what the edges are telling you.
- Chasing gin when a safe knock is available. Going for zero deadwood sounds impressive, but it gives the opponent more turns to improve their hand or knock first.
Opponent difficulty levels
Careless opponents throw without thinking about what helps you. They take from the discard freely and knock at the standard threshold of ten. They are good for learning the flow of the game.
Steady opponents consider the discard before taking it. They need a real improvement before they pick up a card that reveals their hand. They still knock at ten.
Sharp opponents knock at seven, which means they aim for a lower deadwood before ending the hand. They also evaluate throws more carefully. Against them you need to throw high cards faster and knock the moment you are able.
All play stays on your device
The cards are dealt in your browser. No data goes to a server, no account is required, and your best deadwood score is kept in local storage on this machine only. The game works offline once the page has loaded. Close the tab and nothing remains.
