anchor.diff:  (include-book "avl-rational-keys" :dir :teachpacks)
   (include-book "io-utilities" :dir :teachpacks)
  +(include-book "io-utilities-ex" :dir :teachpacks)
   (set-state-ok t)
   
   
  
positive.code:                 
  
  ;test input
  (num-live-neighbors 0 4 4 1 1 
                      (input-lines->avl-tree 0 0 4 (list (coerce "x xx" 'list)
                                                         (coerce "xxxx" 'list)
                                                         (coerce "x  x" 'list)
                                                         (coerce "   x" 'list))
                                             (empty-tree)))
  
negative.code: ;
  ;(defun build-next-generation-cell (width height x y last-gen next-gen)
  ;   )
  
  (defun stdin->string (state)
     (mv-let (chli error state)
             (let ((channel *standard-ci*))
                (if (null channel)
                    (mv nil
                        "Error while opening stdin for input"
                        state)
                    (mv-let (chlist chnl state)
                            (read-n-chars 4000000000 '() channel state)
                       (let ((state (close-input-channel chnl state)))
                         (mv chlist nil state)))))
        (mv (reverse (chrs->str chli)) error state)))
  
  (defun string-list->stdout (strli state)
    (let ((channel *standard-co*))
       (if (null channel)
           (mv "Error while opening stdout"
               state)
           (mv-let (channel state)
                   (write-all-strings strli channel state)
              (let ((state (close-output-channel channel state)))
                (mv nil state))))))
  
  (defun stdin->lines (state)
    (mv-let (chnl state) 
  		 (mv *standard-ci* state)
       (if (null chnl)
           (mv "Error opening standard input" state)
           (mv-let (c1 state)                       ; get one char ahead
                   (read-char$ chnl state)
              (mv-let (rv-lines state)      ; get line, record backwards
                      (rd-lines 4000000000 c1 nil chnl state)
                 (let* ((state (close-input-channel chnl state)))
                       (mv (reverse rv-lines) state))))))); rev, deliver
  
  ;added width input
  (defun get-avl-key (x y width)
  