                  (run-pgm)
                  (dump-tape 0))))
 
+

;; back and forth on one parent
#_(let [g [{:instruction 1}{:instruction 2}{:instruction 3}]
        pgm '(true                  ;; top boolean indicates if moving right
               gtm_tape1           ;;   source is tape1
               exec_y               ;; repeatedly
               ( gtm_copy           ;;   copy a gene
                 exec_if
                 (true gtm_right)
                 (false gtm_left)
                 gtm_blank          ;;   if blank, reverse and move twice
                 exec_if
                 (exec_if false true
                          exec_if
                          (true gtm_right gtm_right)
                          (false gtm_left gtm_left))
                 ()))
        run-pgm #(run-push pgm %)]
    (println "g:" g)(newline)
    (println "result:"

  ^{:stack-types [:gtm :code]}
  (fn [state]
    (if (:gtm state)
      (let [active (:active (:gtm state))
            active-tape (get (:tapes (:gtm state)) active)
            instr-map (get (:contents active-tape) (:position active-tape))]
        (if instr-map
          (trace 'gtm_instruction
                 (update-in
                   (push-item (:instruction instr-map) :code state)
                   [:gtm :tapes active :position]
                   inc))
          state))
      state)))

