Card games for Emacs
Find a file
Corwin Brust 2345f7e1a6 Add live multiplayer 500 over cg-net (cg-bid-net.el)
Host-authoritative networked 500: host sits South, joiners take W/N/E,
open seats filled by AI. Per-seat rotated state hides other hands and the
kitty; clients reuse the single-player renderer/commands via :around advice,
so cg-bid.el/cg-bid-ui.el are untouched. Adds cg-bid-host/cg-bid-join, a
start-now lobby with auto-start at four players, and cg-bid-shuffle-partners.
cg-net.el gains cg-net-connect-functions. Verified: clean byte-compile,
checkdoc, 34/34 ERT (incl. 3 new net tests) and a two-process TCP game.
2026-06-23 23:34:48 -05:00
test Add live multiplayer 500 over cg-net (cg-bid-net.el) 2026-06-23 23:34:48 -05:00
.gitignore initial commit 2026-06-23 19:34:36 -05:00
card-games-pkg.el Add cg-symbols + renderer skins foundation; doc/URL consistency; README fixes 2026-06-23 21:58:10 -05:00
card-games.el Add live multiplayer 500 over cg-net (cg-bid-net.el) 2026-06-23 23:34:48 -05:00
cg-bid-net.el Add live multiplayer 500 over cg-net (cg-bid-net.el) 2026-06-23 23:34:48 -05:00
cg-bid-ui.el Wire cg-gaps and cg-bid display through the renderer registry 2026-06-23 22:17:54 -05:00
cg-bid.el Add cg-symbols + renderer skins foundation; doc/URL consistency; README fixes 2026-06-23 21:58:10 -05:00
cg-core.el Add cg-symbols + renderer skins foundation; doc/URL consistency; README fixes 2026-06-23 21:58:10 -05:00
cg-gaps.el Wire cg-gaps and cg-bid display through the renderer registry 2026-06-23 22:17:54 -05:00
cg-net.el Add live multiplayer 500 over cg-net (cg-bid-net.el) 2026-06-23 23:34:48 -05:00
cg-render.el Add cg-symbols + renderer skins foundation; doc/URL consistency; README fixes 2026-06-23 21:58:10 -05:00
cg-svg.el Add cg-symbols + renderer skins foundation; doc/URL consistency; README fixes 2026-06-23 21:58:10 -05:00
Makefile Add live multiplayer 500 over cg-net (cg-bid-net.el) 2026-06-23 23:34:48 -05:00
README.org Add cg-symbols + renderer skins foundation; doc/URL consistency; README fixes 2026-06-23 21:58:10 -05:00

card-games Play card games in Emacs

Card games for Emacs.

Renders SVG by default when display-graphic-p is t and rsvg is available. The default (UNICODE) symbols maybe customized by configuring card-game-symbols.

Games

  • 500 (Bid) the four-handed partnership trick-taking game, against three computer opponents (M-x cg-bid).
  • Gaps / Hell's Half-Acre solitaire; sort each row into one suit running 2..K (M-x cg-gaps).

To open the game menu type M-x card-game, or start a game directly with its command:

  • cg-montana Montana (also called Gaps). Each row is anchored by a Two and built upward in one suit, 2 through King; slide cards into the gaps until all four rows are sorted.
  • cg-gaps an alias for cg-montana.
  • cg-hells-half-acre the build-down variant: each row is anchored by a King and built downward, King through 2.
  • cg-bid 500 (Bid). Win the auction, name the trump suit, then take tricks with your partner to reach 500 points before the opposing pair.

TODO

  • make the suit symbols customizable (cg-symbols) and obey them
  • a Texinfo manual
  • renderer "skins": let games subclass the display components (text, SVG, full-window SVG)
  • a manual card-size control for the full-window SVG UI
  • more games

Install

From the package tarball

make package           # builds card-games-1.0.50.tar

Then in Emacs: M-x package-install-file RET card-games-1.0.50.tar.

From a local ELPA archive

make elpa              # builds dist/ (archive-contents + tar)
(add-to-list 'package-archives '("cg" . "/path/to/dist/"))
(package-refresh-contents)
(package-install 'card-games)

Manually

Put the cg-*.el and card-games.el files on your load-path and (require 'card-games).

Playing

Both games work with the keyboard everywhere and with the mouse on a graphical display.

  • 500: b bid, p pass, arrows + RET to play (or click a card), n next hand / new game, ? help.
  • Gaps: arrows to move (or hjkl when cg-keys is classic), RET to fill a gap (or click it), r redeal, u undo, n new, ? help.

On a graphical display, v toggles the full-window SVG table and + / - / 0 (Emacs text-scale-adjust) resize the cards.

Customization

M-x customize-group RET cg-svg and RET card-games:

  • cg-svg-theme-colors derive the highlight ring and card backs from your theme (on by default).
  • cg-bid-felt-color the 500 table felt.
  • cg-svg-card-width, cg-svg-card-height, cg-svg-card-shadow, cg-svg-font-family card appearance.
  • cg-svg-card-back card-back pattern: dots, rings, or solid.
  • cg-symbols the Unicode suit glyphs (and the joker) drawn on cards.
  • cg-svg-four-color draw a four-colour deck (clubs green, diamonds blue-purple).
  • cg-keys emacs (default) or classic (adds vi-style hjkl and SPC).
  • cg-bid-animate, cg-bid-ai-delay, cg-bid-trick-pause pace the 500 AI so play is watchable and completed tricks linger.
  • M-x card-games-set-theme apply a preset (classic, dark, contrast).

Development

make compile     # byte-compile (should be warning-free)
make test        # run the ERT suite
make checkdoc    # documentation lint
make release     # clean + test + package + source tarball

License

GPL-3.0-or-later. See the file headers; add a COPYING file with the full GPLv3 text for distribution.