#lang scheme

(require "Clases-neuron-capa-red.rkt")

;;;;;;;;;;;;;;INSTANCIAS
;;;NEURONAS
(define n_1 (make-object neuron_entrada% 'n_1))
(define n_2 (make-object neuron_entrada% 'n_2))

(define n_3 
  (make-object neurona% 'n_3
    1 propagacion_lineal lineal escalon_1))
(define n_4 
  (make-object neurona% 'n_4
    1 propagacion_lineal lineal escalon_1))

(define n_5 
  (make-object neurona% 'n_5
    1 propagacion_lineal lineal escalon_1))
;;;CAPAS
(define capa_1 
  (make-object capa_entrada% 'c_1
    (list n_1 n_2) ))
(define capa_2 
  (make-object capa% 'c_2
    (list n_3 n_3) (list '(1 -1) '(-1 1))))
(define capa_3 
  (make-object capa% 'c_3
    (list n_5) (list '(1 1))))
;;;RED
(define xor (make-object red% (list capa_1 capa_2 capa_3)))

;;;USO
(define estimulos
  (list
   '(1 1)
   '(1 0)
   '(0 1)
   '(0 0)
   ))

(define estimulos->red
  (lambda (red estimulos)
    (let go ((i 0)
             (j (length estimulos))
             )
      (if (= i j)
          #t
          (let ((resp (send red proceso! (list-ref estimulos i))))
            (printf "~a --> ~a~n"
                    (list-ref estimulos i)
                    resp)
            (go (add1 i) j)
            )
          )
      )
    )
  )

(estimulos->red xor estimulos)