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.
This commit is contained in:
@@ -58,10 +58,6 @@
|
|||||||
(setq inp (remove-duplicates (read-integers))))
|
(setq inp (remove-duplicates (read-integers))))
|
||||||
inp))
|
inp))
|
||||||
|
|
||||||
(defun generate-hand ()
|
|
||||||
(->> (make-deck)
|
|
||||||
alexandria:shuffle
|
|
||||||
(split 5)))
|
|
||||||
(defun print-hand (hand)
|
(defun print-hand (hand)
|
||||||
(->> hand cardset->str (format t "Hand=[~a]~%")))
|
(->> hand cardset->str (format t "Hand=[~a]~%")))
|
||||||
|
|
||||||
@@ -83,7 +79,12 @@
|
|||||||
|
|
||||||
(defun start ()
|
(defun start ()
|
||||||
(setf *random-state* (make-random-state t))
|
(setf *random-state* (make-random-state t))
|
||||||
(destructuring-bind (hand . rest) (generate-hand)
|
(destructuring-bind (final-hand . rest)
|
||||||
(declare (ignore rest))
|
(->> (make-deck)
|
||||||
(->> hand cardset->str (format t "Hand=[~a]~%"))
|
alexandria:shuffle
|
||||||
(force-output)))
|
(read-redeal-print nil))
|
||||||
|
(format t "Cards remaining: {~a}
|
||||||
|
|
||||||
|
Final hand: [~a]"
|
||||||
|
(cardset->str rest)
|
||||||
|
(cardset->str final-hand))))
|
||||||
|
|||||||
Reference in New Issue
Block a user