diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-02-14 23:29:37 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-02-14 23:42:06 +0000 |
commit | ae68f3a8f022596db4c869f87c7110863f7be739 (patch) | |
tree | 37f9f282268d007149641c31c999440cb2c6ddb1 | |
parent | d4e8f66c8bed16245328a010e55541d6265af5e0 (diff) | |
download | cantedraw-ae68f3a8f022596db4c869f87c7110863f7be739.tar.gz cantedraw-ae68f3a8f022596db4c869f87c7110863f7be739.tar.bz2 cantedraw-ae68f3a8f022596db4c869f87c7110863f7be739.zip |
Rework cantedraw.main:start to run a read-redeal-print-loop
We've now got one of the major stages of the game down.
I think it's worth investing in some testing functions now - we've
reached just the level of complexity.
-rw-r--r-- | src/main.lisp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.lisp b/src/main.lisp index 8a0631d..f63326d 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -58,10 +58,6 @@ (setq inp (remove-duplicates (read-integers)))) inp)) -(defun generate-hand () - (->> (make-deck) - alexandria:shuffle - (split 5))) (defun print-hand (hand) (->> hand cardset->str (format t "Hand=[~a]~%"))) @@ -83,7 +79,12 @@ (defun start () (setf *random-state* (make-random-state t)) - (destructuring-bind (hand . rest) (generate-hand) - (declare (ignore rest)) - (->> hand cardset->str (format t "Hand=[~a]~%")) - (force-output))) + (destructuring-bind (final-hand . rest) + (->> (make-deck) + alexandria:shuffle + (read-redeal-print nil)) + (format t "Cards remaining: {~a} + +Final hand: [~a]" + (cardset->str rest) + (cardset->str final-hand)))) |