Hearts

Public domain classic

Dodge the hearts and the queen of spades. Or shoot the moon.

Hearts

At a glance

Rules
Hearts for four: you against three computer players, 13 cards each
Passing
Three cards to the left, then to the right, then across, then a hand with no pass, and round again
Match
Ends after the hand in which anyone reaches 100. The lowest total wins
Controls
Tap a glowing card, then the trick area or Play card, or drag the card onto the table. Tab, Enter and Space also work. Esc opens the menu
Help
Legal cards glow, and Hint picks a card for you
Speed
Each computer move takes about 0.65 seconds on Steady, 0.3 on Fast and 1.1 on Relaxed
Saves
Matches, wins, hands and your best final score, in this browser only
Cost
Free, no account

How this Hearts plays

  • Seats run You, West, North, East, and play goes round in that order. Passing left sends your three cards to West, right sends them to East, and across sends them to North.
  • Whoever holds the 2 of clubs must lead it to the first trick. The winner of each trick leads the next.
  • Follow the led suit if you can. If you cannot, any card is allowed, except that on the first trick you may not throw a heart or the queen of spades unless your hand holds nothing else.
  • No one can lead a heart until a heart has been played, unless their hand is all hearts. The queen of spades does not break hearts.
  • Points: each heart is 1 and the queen of spades is 13, so every hand gives out 26.
  • Shooting the moon: take all 26 and you score 0 for the hand, while each other player takes 26.
  • If two players tie for the lowest total at the end, the win goes to whoever comes first in seat order, so a tie with you goes your way.

How the computer players think

  • Passing: each computer ranks its cards by height, adds a big weight to the queen, king and ace of spades, a smaller one to every heart, and extra for a card that is alone in its suit, then passes the top three.
  • Leading: it leads its lowest legal card.
  • Following suit: it plays its highest card that still loses to the card currently winning. If every card it can play would win, it plays its lowest when the trick holds points and its highest when the trick is clean.
  • Out of the suit: it throws the card worth the most points first, so the queen of spades goes before any heart, and after that its highest card.
  • Going for the moon: a computer dealt at least three hearts of 10 or higher and at least five cards of queen or higher plays its highest legal card every time that hand.
  • There is one strength and no random choice: given the same cards, a computer always does the same thing. Hint runs the same thinking on your hand, and while passing it picks the three cards a computer would pass.

Tips that follow from the rules

  • Use the first trick. Points can rarely be thrown on it, so it is usually a cheap moment to get rid of a high club.
  • Count to 26. Every hand gives out exactly 26 points. If one player has taken nearly all of them, taking a single heart yourself stops the moon.
  • Expect spades in a pass. The computers pass their queen, king and ace of spades whenever they hold them, so if the computer passing to you holds any of them, they come to you.
  • Hand four has no pass. You play the cards you were dealt, so plan from the deal.

For partnership trick-taking with bids instead of penalty cards, try Spades.

Known limits

  • No undo.
  • No difficulty setting: the three computers play one fixed way.
  • The match length is fixed at 100.
  • A selected card is raised and drawn over the card to its right, so tap that card near its lower edge to pick it.
  • At a 1280 by 720 window the game frame is 848 pixels tall, taller than the window, so scroll to reach your hand or use Fullscreen.
  • Switching tabs pauses the game and opens the menu.
  • If storage is blocked, the game still runs but your stats are not kept.

How it was built and checked

AI tool
Codex
First committed
2026-10-15, in a batch of nine card games, built in the same run as Spades and Gin Rummy
Size
One HTML file of 87 lines, no game libraries
Rounds of changes
1, from the build record
Checked at build
The build report: 187,130 rule checks, 300 complete simulated deals, 3 full computer matches to the target, and no computer choice taking longer than 0.34 ms. It lists real appearance, touch and drag, keyboard focus, portrait and landscape layout and screen-reader output as not verified
Checked since
2026-11-11: the rule test passes again with its random play now seeded (187,134 checks for Hearts, now including that the queen of spades does not break hearts, that a tie for lowest goes to the earlier seat and that a computer passes the queen of spades it holds), and an automated browser check of the local build at 1280 by 720 and 390 by 844. Each time it tapped three cards and passed them, finished a hand by tapping cards and by Hint then Play card, started the next hand, set the scores to 80, 99, 99 and 99, played that hand to the end of the match, and started again
Played on a phone
2026-11-11, a full game on a real phone before this page went live

Embed Hearts on your site

Free to embed. Please keep the credit link.

<div style="position:relative;padding-top:75%;max-width:640px"><iframe src="https://aivibecodedgames.com/games/hearts/" title="Hearts (free browser game)" style="position:absolute;inset:0;width:100%;height:100%;border:0" loading="lazy" allow="fullscreen" allowfullscreen></iframe></div>
<p><a href="https://aivibecodedgames.com/play/hearts/">Play Hearts free</a> on AI Vibe Coded Games</p>

How it was vibe coded

ToolCodex
Rounds of changes: 1
First committed2026-10-15

The opening prompt

Make Hearts for four players: you against three computer players. 13 cards each. Pass three cards to the left on hand 1, to the right on hand 2, across on hand 3, and no pass on hand 4, then repeat. The player with the two of clubs leads. You must follow suit; no hearts or queen of spades on the first trick; hearts cannot be led until broken. Each heart scores 1 point and the queen of spades 13; shooting the moon gives 26 points to the three others. The game ends when someone reaches 100, lowest score wins. Computers should pass high spades and high hearts, avoid taking points, dump the queen of spades on others, duck with low cards, and occasionally try to shoot the moon. Show the trick area, a scoreboard, highlight the legal cards, and offer a hint and a speed setting.

Game controls

  • Tap a card to pass it, then tap Pass
  • Tap a glowing card, then the trick area
  • Hint picks a card for you

The game brief includes touch controls for phones.

Open the game on its own

More games