;;;
;;; c:\\program files\\acl62\\music45.cl
;;;
(load "c:\\program files\\acl62\\music44.cl")

(defun make-O-2-aux ()
  (my-randomize)
  (do ((l1 '(0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0))
     (l2 '(0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0))
     (w (list (nth (random 12) '(do +do re +re mi fa +fa so +so la +la si)))))
     ((eq (length w) 11) (reverse w))
   (let* ((num1 (nth (random (length l1)) l1))
       (num2 (nth (random (length l2)) l2))
       (note1 (up-a-note (car w) num1))
       (note2 (down-a-note (car w) num2)))
     (case (random 2)
       (0
        (cond ((not (member note1 w))
             (push note1 w)
             (setf l1 (remove num1 l1)))))
       (1
        (cond ((not (member note2 w))
             (push note2 w)
             (setf l2 (remove num2 l2)))))))))

(defun make-O-2 ()
  (let* ((lst (make-O-2-aux))
      (note (remove-first-list-from-second-list lst '(do +do re +re mi fa +fa so +so la +la si))))
    (append lst note)))

(defun twelve-kinds-of-notes (lst)
  (format t "~%~a~%~a~%~a~%~a~%~a~%~a~%~a~%~a~%~a~%~a~%~a~%~a"
    lst
    (m2-up lst)
    (M2-up lst)
    (m3-up lst)
    (M3-up lst)
    (P4-up lst)
    (+4-5-up lst)
    (P5-up lst)
    (m6-up lst)
    (M6-up lst)
    (m7-up lst)
    (M7-up lst)))

(defun make-4-kinds-of-notes-series-2 ()
  (let* ((l1 (make-O-2))
      (l2 (make-R l1))
      (l3 (make-I l1))
      (l4 (make-IR l1)))
    (format t "~%基本形 O-2 :~a." l1)
    (format t "~%逆行形 R-2 :~a." l2)
    (format t "~%反行形 I-2 :~a." l3)
    (format t "~%反行逆行形 IR-2:~a." l4)))

(defun all-note-series-2 ()
  (let* ((l1 (make-O-2))
      (l2 (make-R l1))
      (l3 (make-I l1))
      (l4 (make-IR l1)))
    (format t "~%***** 基本形O_2-1〜12")
    (twelve-kinds-of-notes l1)
    (format t "~%***** 逆行形R_2-1〜12")
    (twelve-kinds-of-notes l2)
    (format t "~%***** 反行形I_2-1〜12")
    (twelve-kinds-of-notes l3)
    (format t "~%***** 反行逆行形IR_2-1〜12")
    (twelve-kinds-of-notes l4)))