Fix some issues in main
This commit is contained in:
@@ -51,16 +51,16 @@
|
|||||||
(fn read-until-valid-integers () (-> nil list)
|
(fn read-until-valid-integers () (-> nil list)
|
||||||
(let ((inp (remove-duplicates (read-integers))))
|
(let ((inp (remove-duplicates (read-integers))))
|
||||||
(while (not (and (every #'is-valid-hand-index inp)
|
(while (not (and (every #'is-valid-hand-index inp)
|
||||||
(< (length inp) 5)
|
(<= (length inp) 5)
|
||||||
(>= (length inp) 0)))
|
(>= (length inp) 0)))
|
||||||
(format t "Need at most 5 integers between 0 and 4...~%")
|
(format t "Need at most 5 integers between 0 and 4...~%")
|
||||||
(force-output)
|
(force-output)
|
||||||
(setq inp (remove-duplicates (read-integers))))
|
(setq inp (remove-duplicates (read-integers))))
|
||||||
inp))
|
inp))
|
||||||
|
|
||||||
(fn read-and-confirm-valid-integers (hand) (-> nil list)
|
(fn read-and-confirm-valid-integers (hand) (-> (cardset) list)
|
||||||
(let ((confirm nil)
|
(let ((confirm nil)
|
||||||
inp)
|
(inp nil))
|
||||||
(while (null confirm)
|
(while (null confirm)
|
||||||
(setq inp (read-until-valid-integers))
|
(setq inp (read-until-valid-integers))
|
||||||
(if (null inp)
|
(if (null inp)
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
:collect (nth index hand))
|
:collect (nth index hand))
|
||||||
cardset->str
|
cardset->str
|
||||||
(format t "To redeal: ~a~%")))
|
(format t "To redeal: ~a~%")))
|
||||||
(setq confirm (y-or-n-p "Confirm: ")))
|
(setq confirm (y-or-n-p "Confirm:")))
|
||||||
inp))
|
inp))
|
||||||
|
|
||||||
(defun print-hand (hand)
|
(defun print-hand (hand)
|
||||||
@@ -99,6 +99,7 @@
|
|||||||
(read-redeal-print nil))
|
(read-redeal-print nil))
|
||||||
(format t "Cards remaining: {~a}
|
(format t "Cards remaining: {~a}
|
||||||
|
|
||||||
Final hand: [~a]"
|
Final hand: [~a]
|
||||||
|
"
|
||||||
(cardset->str rest)
|
(cardset->str rest)
|
||||||
(cardset->str final-hand))))
|
(cardset->str final-hand))))
|
||||||
|
|||||||
Reference in New Issue
Block a user