Crazy Eights, Spite & Malice, Old Maid: SVG boards" \

discard, suit in play, stock, and the hand.
* cg-spite.el (cg-spite--board-svg, cg-spite--render-text): centre piles,
goal, discards, and hand.
* cg-match.el (cg-om--svg, cg-om--render-text, cg-render-apply): Old Maid
board with clickable target cards; wire mouse-1, zoom, and cg-current-game.
* test/card-games-tests.el: add cgt-eights-svg-smoke, cgt-spite-svg-smoke,
cgt-om-svg-smoke.
* NEWS: note the new boards.
This commit is contained in:
Corwin Brust 2026-07-01 05:06:29 -05:00
parent 2ee802f52d
commit 32fb9f0c6d
5 changed files with 222 additions and 3 deletions

View file

@ -894,6 +894,31 @@
(should (rassoc '(hand . 0)
(get-text-property 0 'cg-regions (cg-fish--svg g))))))
(ert-deftest cgt-eights-svg-smoke ()
(let ((g (cg-eights-game)))
(cg-put g :nplayers 3) (cg-put g :scores (make-vector 3 0))
(cg-eights--deal g) (cg-put g :cursor 0) (cg-put g :message "x")
(should (stringp (cg-eights--render-text g)))
(let ((regs (get-text-property 0 'cg-regions (cg-eights--board-svg g))))
(should (rassoc '(hand . 0) regs))
(should (cl-every (lambda (r) (= 4 (length (car r)))) regs)))))
(ert-deftest cgt-spite-svg-smoke ()
(let ((g (cg-spite-game)))
(cg-put g :nplayers 2) (cg-put g :scores (make-vector 2 0))
(cg-spite--deal g) (cg-put g :cursor 0) (cg-put g :message "x")
(aset (cg-get g :center) 0 (cons 3 (list '(1 . 3))))
(should (stringp (cg-spite--render-text g)))
(should (rassoc '(hand . 0)
(get-text-property 0 'cg-regions (cg-spite--board-svg g))))))
(ert-deftest cgt-om-svg-smoke ()
(let ((g (cg-old-maid-game)))
(cg-om--deal g)
(cg-put g :phase 'play) (cg-put g :turn 0) (cg-put g :message "x")
(should (stringp (cg-om--render-text g)))
(should (stringp (cg-om--svg g)))))
(ert-deftest cgt-pat-golf-deal ()
(let ((g (cg-pat--deal (cg-golf-game))))
(should (= 35 (length (cg-get g :cards))))