anchor.diff:        (setq res (discriminate-values (tree-node-right-child node) object-value topic-value feature-name))))
     res)
   
  -;; loops over the feature detectors (channels) of the agent
  -;; to try to discriminate the two objects in each of them
  -(defun discriminate-channels (channels topic object)
  -  "Discrimination attempt on all the given feature detectors (channels)"
  -  (loop for fd in channels do 
  -       (discriminate-values (sensory-channel-discrimination-tree fd) topic object (sensory-channel-feature-name fd))))
  +;; Gets the discrimination tree that belongs to a channel in the given list
  +;; corresponding with the given name
  +(defun get-node-channel-by-name (channels name)
  +  "Returns a discrimination tree for the channel with the given name
  +in the given list"
  +  (loop for c in channels do
  +       (when (String= name (sensory-channel-feature-name c))
  +         (return-from get-node-channel-by-name (sensory-channel-discrimination-tree c)))))
  +
  +;; List the channel names for a given list of channels
  +(defun get-channel-names (channels)
  +  "Returns the feature names for a given list of channels"
  +  (loop for c in channels
  +       collect (sensory-channel-feature-name c)))
   
   ;; Function in charge of making a discrimination between the objects of a scene
   ;; using the feature detectors (channels) of the agent
   (defun run-discrimination(channels scene)
     (let ((res '()))
       (loop for obj in (scene-objects scene) do
  -         (loop for gc in *game-channels* do
  -              (let ((disc (discriminate-channels channels (get-input-object-value (scene-topic scene) gc) (get-input-object-value obj gc))))
  +         (loop for gc in (get-channel-names channels) do
  +              (let ((disc (discriminate-values (get-node-channel-by-name channels gc) (get-input-object-value (scene-topic scene) gc) (get-input-object-value obj gc) gc)))
                   (when (not (eq disc nil))
                     (setq res (append res (list disc)))))))
       res))
   
  -;; Function in charge of 
  -(defun reward-discrimination-trees(trees)
  -  (let ((tr (nth (random (length trees) (make-random-state t)) trees)))
  +;; Given a list of discrimination results gives back their discrimination trees
  +(defun get-trees-from-discrimination-results(disc-results)
  +  "Returns the discrimination trees from a given list of discrimination results"
  +  (loop for dr in disc-results
  +       collect (discrimination-result-discrimination-node dr)))
  +
  +;; Function in charge of rewarding a successfull discrimination node
  +(defun reward-discrimination-trees(discrimination-results)
  +  (let* ( (trees (get-trees-from-discrimination-results discrimination-results)) (tr (nth (random (length trees) (make-random-state t)) trees)))
       (loop for tree in trees do
            (when(> (node-data-score (tree-node-data tree)) (node-data-score (tree-node-data tr)))
              (setq tr tree)))
  
positive.code:          (setq channels (append channels (list (make-sensory-channel :feature-name c :discrimination-tree (get-root))))))
      channels))
  
  ;; Function to create a scene using the random objects. The topic is removed from the
  ;; list of objects in the scene to avoid redundant comparisons.
  (defun create-scene()
    "creates a scene for the game"
    (let* ((objs (get-random-scene-objects)) 
           (tpc (nth (random *number-of-objects-per-scene* (make-random-state t)) objs)) 
           (scene (make-scene :objects (remove tpc objs) :topic tpc)))
      scene
      ))
  
  ;; Gets the lower bound of a node, basic wrapper for slot accessor
  (defun get-lower-bound(node)
  
negative.code: of the structure for the given input object"
    (funcall (symbol-function (find-symbol (string-upcase (concatenate 'string "input-object-" slot-name)))) input-object))
  
  ;; Functional setter for a property of a given input object
  (defun set-input-object-value (input-object value slot-name)
    "Given a string for the slot name sets the value using the slot-value function 
  of the structure for the given input object"
    (setf (slot-value input-object (find-symbol (string-upcase slot-name))) value))
  
  
  ;; Gets a list with the contents of the object and returns an input-object based on it.
  (defun input-object-from-list(list-args)
    (let ((input-obj (make-input-object  :x (nth 0 list-args) :y (nth 1 list-args) :z (nth 2 list-args) :width (nth 3 list-args) :height (nth 4 list-args) :avg-y (nth 5 list-args) :avg-u (nth 6 list-args) :avg-v (nth 7 list-args) :min-y (nth 8 list-args) :min-u (nth 9 list-args) :min-v (nth 10 list-args) :max-y (nth 11 list-args) :max-u (nth 12 list-args) :max-v (nth 13 list-args) :stdv-y (nth 14 list-args) :stdv-u (nth 15 list-args) :stdv-v (nth 16 list-args))))
  