Make a solo card game with your own rules and card designs
A digital card game is three things: a fair shuffle, rules the computer enforces so the player doesn't have to, and cards that feel good to move. Anticode can build solo card games of that kind, from classic patience games to a deck you invented, with the cards drawn in code and win statistics saved on the player's device.
What you can build
- Patience games: Klondike, FreeCell, Spider, Pyramid, Golf, or a variant with your own twist.
- Solo deck-builders and roguelikes: start with a weak deck, add cards between fights, face a computer-controlled opponent.
- Prototypes of a physical card game: try your rules on screen before printing a deck, playing against simple computer opponents.
- Learning games with cards: times tables, vocabulary or history dates as a matching or ordering game.
Shuffling fairly
The right way to shuffle in code is the Fisher-Yates shuffle: walk through the deck and swap each card with a random card at or after its position. It gives every order an equal chance. The common home-made alternative, sorting by a random number, quietly biases some orders, which players of a patience game eventually notice as "it always deals the same kind of hand".
Two extras are worth asking for. A deal number lets someone replay or share a specific deal ("try deal 4127") because the shuffle is driven from that number. Winnable deals only matters for games like Klondike, where some deals can't be won: the game can pick from deals a solver has confirmed, or simply label the mode honestly.
Rules the game enforces
A good card game maker turns your rules into code that does the bookkeeping. That means legal moves only (a red six can't go on a red seven), automatic moves where there's no choice (cards to the foundation at the end), and a hint button that shows a legal move when the player is stuck. Write your rules as you'd explain them to a friend, including the edge cases: what happens when the stock runs out, how many redeals are allowed, whether an empty column accepts any card or only a king.
| Detail | Why it matters |
|---|---|
| Drag and tap-to-move | Dragging is natural with a mouse; on a phone, tapping a card to send it to the best legal spot is faster |
| Unlimited undo | Players experiment more and quit less |
| Snap and animate | Cards that glide into place show the move was accepted |
| Keyboard play | Arrow keys to select and Enter to move, so the game isn't mouse-only |
| Readable at 360 pixels | Seven columns on a phone need compact cards with large corner indices |
Your own card designs, drawn in code
Anticode apps can't load card images from the web, so the deck is drawn with SVG or canvas: suits, pips, court cards as stylised illustrations or bold letters, card backs as patterns. That gives you full control over the look. Describe it ("art deco faces, gold on deep green, a fan pattern on the back") or give your own colour scheme. For an invented deck, list each card's name, cost and effect. If you have card art already, add the images to the build and say which card each belongs to.
Describing it to Anticode
A complete request for a patience game might read: "FreeCell with deal numbers, tap-to-move on phones and drag on desktop, unlimited undo, a hint button, auto-move to foundations, and statistics for games played, won and the current streak. Calm look, dark blue table, large card indices." The model writes it as one HTML document in plain JavaScript; the Architect may ask first whether you want animations kept subtle or a winning card cascade.
Statistics, settings and a game in progress save in the player's browser, so closing the tab mid-game doesn't lose it. Ask for that explicitly if you want resume to work.
Limits
- Solo or same-device only. No online card games against other people; Anticode apps have no network. Two people can share a screen, as on the two-player game page.
- No real-money play or gambling. No payments run inside apps, and gambling games need licences in most places regardless.
- No card collections that sync. A deck-builder's unlocked cards stay on that device.
- Computer opponents are only as smart as the rules. For complex strategy games they'll be competent rather than expert.
For a turn-taking duel with dice instead, a dice roller can sit beside your physical game; for flipping pairs, see the memory game maker.
Questions people ask
Can I print my custom deck from the game?
You can ask for a print layout that puts the cards on a page, then print from the browser. Check sizes with a test print before a full deck.
Can I use classic rules like Klondike?
Yes. Traditional patience games have been played for a long time and their rules are widely published. What not to copy is a particular app's name, art or layout, so describe the rules rather than a product.
Can I add new card types later?
Ask for them in a sentence, with each card's effect. The rest of the game stays as it was, and recent versions are kept in history.