diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.lisp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.lisp b/src/main.lisp index 422beab..8a0631d 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -62,6 +62,24 @@ (->> (make-deck) alexandria:shuffle (split 5))) +(defun print-hand (hand) + (->> hand cardset->str (format t "Hand=[~a]~%"))) + +(defun read-redeal-print (hand deck) + (cond + ((<= (length deck) 5) + (cons hand deck)) + ((null hand) + (destructuring-bind ((hand) . deck) (deal-hands 1 deck) + (print-hand hand) + (read-redeal-print hand deck))) + (t + (let ((indices (read-until-valid-integers))) + (if (null indices) + (cons hand deck) + (destructuring-bind (hand . deck) (redeal-hand hand indices deck) + (print-hand hand) + (read-redeal-print hand deck))))))) (defun start () (setf *random-state* (make-random-state t)) |