Fix some issues in main

This commit is contained in:
2025-03-01 20:10:07 +00:00
parent 93790fad88
commit 5f4bfd77bd

View File

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