Skip to content

Instantly share code, notes, and snippets.

@t-sin
Created May 28, 2016 14:15
Show Gist options
  • Save t-sin/319ff256dc1e462cd46b6d0833579778 to your computer and use it in GitHub Desktop.
Save t-sin/319ff256dc1e462cd46b6d0833579778 to your computer and use it in GitHub Desktop.
ズン・ズンズンズンドコ \キ・ヨ・シ/
(defun zundoko ()
(let ((zundoko '(ズン ドコ))
(zundoko-state 0))
(labels ((randoko ()
(nth (random 2) zundoko))
(zundoko-reset () (setf zundoko-state 0))
(zundoko-next () (incf zundoko-state))
(zundoko-check (s zd true-ret true-fn)
(if (eq (find s zundoko) zd)
(prog1 true-ret (funcall true-fn))
(prog1 nil (zundoko-reset))))
(kiyoshi-p (s)
(if (and (<= 0 zundoko-state)
(> 4 zundoko-state))
(zundoko-check s 'ズン nil #'zundoko-next)
(zundoko-check s 'ドコ t #'zundoko-reset))))
(loop
:for s := (print (randoko))
:until (kiyoshi-p s)
:finally (print 'キ・ヨ・シ)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment