#lang racket/gui

(require "Matrices.rkt")
(require "Reglas-vecindad.rkt")
(require "Animat.rkt")
;;;;;;;;;;;;;;
(define elemento%
  (class color%
    (init-field
     (estado 0)
     (dureza 0)
     (olor 'objeto_tipo_olor)
     )
    (define/public set-olor
      (lambda (obj)
        (set! olor obj)
        ))
    (define/public get-olor
      (lambda ()
        olor
        ))
    (define/public get-rgb
      (lambda ()
        (let ((r (send this red))
              (g (send this green))
              (b (send this blue))
              (o (send this alpha))
              )
          (list r g b o)
          )
        ))
    (define/public get-color
      (lambda ()
        this ))
    (define/public get-estado
      (lambda ()
        estado ))
    (define/public get-dureza
      (lambda ()
        dureza ))
;;aquí se añaden los procedimientos de computación    
    (super-new)
    ))
;;Objetos del tipo OLOR
(define olor%
  (class object%
    (init-field
     (tipo 0)
     (intensidad 0)
     )
    (define/public get-tipo
      (lambda ()
        tipo ))
    (define/public get-intensidad
      (lambda ()
        intensidad ))
    (define/public update-intensidad
      (lambda (valor);entero positivo o -1
        (set! intensidad
              (+ intensidad valor))
        ))
    (super-new)
    ))
;;;;;;;;;;;;
(define olor0;inodora
  (make-object olor% 0 0))
(define olor1;feromonas
  (make-object olor% 1 30))
(define olor2;comida verde
  (make-object olor% 2 10))
(define olor3;comida amarillo
  (make-object olor% 3 10))
(define olor4;el olor de una hormiga
  (make-object olor% 4 1))
(define olor5;el olor de otro autómata
  (make-object olor% 5 1))
(define olor6;el olor de azul y marrón
  (make-object olor% 6 1))
;;Estado dureza olor R   G   B   O
(define blanco
  (make-object elemento% 0 0 (make-object olor% 0 0) 255 255 255 1.0))

(define rojo
  (make-object elemento% 1 5 (make-object olor% 5 1) 255 0 0 1.0))
(define verde
  (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(define negro
  (make-object elemento% 3 6 (make-object olor% 4 1) 0 0 0 1.0))
(define amarillo
  (make-object elemento% 4 3 (make-object olor% 3 10) 255 255 0 1.0))

(define azul
  (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(define marron
  (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;
(define entorno%
  (class object%
    (init-field
     (ff 0)
     (cc 0)
     )
    (define set-matriz
      (lambda (matriz)
        (let rows ((i 0)
                   (j ff))
          (if (= i j)
              matriz
              (let columnas ((m 0)
                             (n cc))
                (if (= m n)
                    (rows (add1 i) j)
                    (begin
                      (matriz-set! matriz i m blanco)
                      (columnas (add1 m) n))
                    )
                )
              )
          )
        ))
    (define/public set-configuracion
      (lambda ()
        (set! configuracion (es-configuracion))
        ))
    (define es-configuracion
      (lambda ()
        (map
         (lambda (fila)
           (map
            (lambda (obj)
              obj;
              )
            (vector->list fila))
           )
         (vector->list matriz-objetos)
         )
        ))
    (define/public set-locus!
      (lambda (f c obj)
        (matriz-set! matriz-objetos f c obj)
        #t
        ))
    (field
     (matriz-objetos
      (set-matriz
       (make-matriz ff cc)))
     (configuracion (es-configuracion))
     )
    (define/public get-matriz
      (lambda ()
         matriz-objetos ))
    (define/public get-dimensiones
      (lambda ()
        (cons ff cc) ))
    (define/public get-obj
      (lambda (x y)
        (matriz-ref matriz-objetos x y vector-ref)
        ))
    (define/public get-configuracion
      (lambda ()
        (es-configuracion) ))
    (define son-estimulos
      (lambda (e1 e2 e3 e4 e5 e6 e7 e8 orientacion)
        (cond
          ((eq? orientacion 'N) (values e1 e2 e3))
          ((eq? orientacion 'E) (values e3 e4 e5))
          ((eq? orientacion 'S) (values e5 e6 e7))
          ((eq? orientacion 'O) (values e7 e8 e1))
          )
        ))
    (define ley-basica
      (lambda (vec anim clave)
        (let* ((vec_obj (matriz-ref matriz-objetos (car vec) (cdr vec) vector-ref))
               (rgb_vec (send vec_obj get-rgb))
               )
          (cond
            ((eq? clave 'avanzar) (equal? rgb_vec (send blanco get-rgb)))
            ((eq? clave 'comer) (equal? rgb_vec (send verde get-rgb)))
            (else #f)
            )
          )
        ))
    (define/public procesar!
      (lambda (iter)
        (let rows
          ((i 0)
           (j ff)
           )
          (if (= i j)
              (set! configuracion (es-configuracion))
              (let columns
                ((m 0)
                 (n cc)
                 )
                (if (= m n)
                    (rows (add1 i) j)
                    (let ((Obj (matriz-ref configuracion i m list-ref))
                          )
                      (cond
                        ((is-a? Obj animat%)
                         (printf "Iteración-~a  " iter)
                         (let*-values
                             ([(v1 v2 v3 v4 v5 v6 v7 v8) (Moore i m (sub1 ff) (sub1 cc))]
                              [(obj-v1)
                               (matriz-ref 
                                configuracion (car v1) (cdr v1) list-ref)]
                              [(obj-v2)
                               (matriz-ref 
                                configuracion (car v2) (cdr v2) list-ref)]
                              [(obj-v3)
                               (matriz-ref 
                                configuracion (car v3) (cdr v3) list-ref)]
                              [(obj-v4)
                               (matriz-ref 
                                configuracion (car v4) (cdr v4) list-ref)]
                              [(obj-v5)
                               (matriz-ref 
                                configuracion (car v5) (cdr v5) list-ref)]
                              [(obj-v6)
                               (matriz-ref 
                                configuracion (car v6) (cdr v6) list-ref)]
                              [(obj-v7)
                               (matriz-ref 
                                configuracion (car v7) (cdr v7) list-ref)]
                              [(obj-v8)
                               (matriz-ref 
                                configuracion (car v8) (cdr v8) list-ref)]
                              [(vecinos-coord) (list v1 v2 v3 v4 v5 v6 v7 v8)]
                              [(vecinos-obj) (list obj-v1 obj-v2 obj-v3 obj-v4 obj-v5 obj-v6 obj-v7 obj-v8)]
                              [(accion vec anim)
                               (send Obj procesar! i m vecinos-coord vecinos-obj)]
                              )
                           (cond
                             ((eq? accion 'morir)
                              (read-char)
                              (matriz-set! matriz-objetos (car anim) (cdr anim) (make-object elemento% 0 0 (make-object olor% 0 0) 255 255 255 1.0))
                              )
                             ((eq? accion 'avanzar)
                              (when (ley-basica vec anim accion)
                                (let
                                    ((vec_obj (matriz-ref matriz-objetos (car vec) (cdr vec) vector-ref)) )
                                  (matriz-set! matriz-objetos (car vec) (cdr vec) Obj)
                                  (matriz-set! matriz-objetos i m vec_obj)
                                  )
                                )
                              )
                             ((eq? accion 'comer)
                              (when (ley-basica vec anim accion)
                                (matriz-set! matriz-objetos (car vec) (cdr vec) blanco)
                                )
                              )
                             ((eq? accion 'girar) )
                             )
                           (rows j j)
                           ) )
                        (else (columns (add1 m) n))
                        )
                      )
                    )
                )
              )
          )
        ))
    (super-new)
    ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define M (make-object entorno% 50 50))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(send M set-locus! 7 2 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 7 3 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 7 4 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 7 5 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 7 6 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 7 7 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 8 2 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 8 3 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 8 4 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 8 5 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 8 6 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 8 7 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 9 2 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 9 3 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 9 4 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 9 5 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 9 6 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 9 7 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 10 2 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 10 3 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 10 4 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 10 5 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 10 6 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 10 7 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 11 2 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 11 3 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 11 4 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 11 5 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 11 6 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 11 7 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 12 2 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 12 3 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 12 4 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 12 5 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 12 6 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
(send M set-locus! 12 7 (make-object elemento% 4 3 (make-object olor% 3 10) 255 215 0 1.0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(send M set-locus! 2 2 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 2 3 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 2 3 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 4 2 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 4 3 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 4 6 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 4 7 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 14 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 15 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 12 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 12 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 12 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 14 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 14 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 14 26 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 14 27 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 18 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0));;;;;;;;;;;;;
(send M set-locus! 18 24 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 18 25 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 19 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 20 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 18 18 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0));;;;;;;;;;;;;
(send M set-locus! 18 19 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 18 20 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 19 18 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 20 18 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 22 20 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0));;;;;;;;;;;;;
(send M set-locus! 22 21 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 22 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 23 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 24 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 24 35 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 25 35 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 22 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 22 3 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 22 3 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 24 2 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 24 3 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 24 6 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 24 7 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 28 3 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 28 4 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 28 5 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 29 3 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 30 3 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 34 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 35 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 30 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 32 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 33 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 34 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 37 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 29 37 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 31 37 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 29 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 32 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 33 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;
(send M set-locus! 29 34 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0));;

(send M set-locus! 33 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 32 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 33 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 34 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 33 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 32 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 34 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
;(send M set-locus! 35 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 32 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 31 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 34 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 35 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 32 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 33 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 34 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 37 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 36 38 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 37 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 38 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 8 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 32 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 33 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 34 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 7 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 9 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 10 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 7 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 6 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 32 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 33 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 34 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 35 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 37 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 38 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 11 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 13 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 13 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 25 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 25 16 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 26 13 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 26 14 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 26 17 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 26 18 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 27 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 27 16 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 40 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 40 16 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 13 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 14 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 17 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 18 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 15 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 16 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 39 25 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 28 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 29 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 30 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 31 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 39 25 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 40 25 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 25 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 24 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 24 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 43 24 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 43 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 44 25 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 44 24 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 45 25 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 44 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 45 26 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 44 27 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 48 48 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0));;
(send M set-locus! 48 47 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 46 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 45 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 44 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 43 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 42 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 41 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 40 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 39 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 38 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 37 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 36 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 48 35 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 46 35 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 47 35 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 35 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 36 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 37 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 38 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 39 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 41 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 42 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 43 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 44 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 45 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 46 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 47 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 45 48 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 46 48 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 47 48 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0));;

(send M set-locus! 25 9 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 25 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 25 11 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 25 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 25 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 26 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 27 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 28 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 29 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 30 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 31 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 32 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 33 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 34 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 35 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 36 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 37 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 38 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 39 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 40 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 41 8 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 28 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 29 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 30 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 31 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 32 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 33 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 34 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 35 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 36 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 37 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 38 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 39 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 40 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 41 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 42 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 43 10 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 10 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 11 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 12 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 13 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 14 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 15 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 16 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 17 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 18 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 19 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 20 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 21 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 22 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 23 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 24 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 25 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 26 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 27 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 28 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 29 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 30 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 31 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 32 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 33 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 34 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 35 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 36 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 37 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 38 45 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 39 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 40 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 41 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 45 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 44 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 42 43 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 18 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 19 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 20 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 21 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 22 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 23 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 24 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 25 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 26 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 27 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 28 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 29 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 30 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 31 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 32 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 33 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 34 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 35 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 36 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 37 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 38 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 39 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 40 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 41 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 42 2 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 42 3 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 42 4 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 42 5 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))

(send M set-locus! 2 20 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 3 20 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 20 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 21 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 22 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 23 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 24 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 25 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 28 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 29 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 30 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 31 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 34 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 35 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 36 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 37 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 3 36 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 4 37 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 26 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 21 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 22 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 23 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 24 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 25 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 26 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 27 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 28 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 29 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 30 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 31 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 32 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 33 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 34 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 35 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
;(send M set-locus! 2 36 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0)
(send M set-locus! 2 37 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 38 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 39 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))
(send M set-locus! 2 40 (make-object elemento% 6 8 (make-object olor% 6 1) 132 60 36 1.0))

(send M set-locus! 44 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 45 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 4 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 46 4 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
;(send M set-locus! 46 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 3 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 4 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 48 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 49 2 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 44 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 45 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 46 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 48 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 49 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 46 13 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 14 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 48 14 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 10 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 11 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 12 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 13 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 14 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 15 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 16 13 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 17 14 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 18 14 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 1 12 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 2 12 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 3 12 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 4 12 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 5 12 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 6 12 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 7 13 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 14 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 9 14 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 1 42 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 2 42 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 3 42 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 4 42 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 5 42 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 6 42 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 6 43 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 7 43 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 7 44 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 8 44 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))
(send M set-locus! 9 44 (make-object elemento% 5 7 (make-object olor% 6 1) 0 0 255 1.0))

(send M set-locus! 44 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 45 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 46 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 48 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 49 22 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 46 23 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
;(send M set-locus! 46 24 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0));
(send M set-locus! 47 24 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 25 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 47 26 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))

(send M set-locus! 14 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 15 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 16 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 18 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 19 12 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 16 13 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 16 14 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0));
(send M set-locus! 17 14 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 17 15 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
(send M set-locus! 17 16 (make-object elemento% 2 2 (make-object olor% 2 10) 0 255 0 1.0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define blancos-en
  (lambda (matriz dimensiones)
    (let rows
      ((i 0)
       (j (car dimensiones))
       (salida '())
       )
      (if (= i j)
          salida
          (let columns
            ((m 0)
             (n (cdr dimensiones))
             )
            (if (= m n)
                (rows (add1 i) j salida)
                (if (equal? (list 255 255 255 1.0)
                            (send
                             (send M get-obj i m)
                             get-rgb))
                    (begin
                      (set! salida (cons (cons i m) salida))
                      (columns (add1 m) n)
                      )
                    (columns (add1 m) n))
                )
            )
          )
      )
    ))
(define ubica-animat
  (lambda (animat)
    (let* 
        ((hay-blancos
          (blancos-en (send M get-matriz) (send M get-dimensiones)))
         (azar (random (length hay-blancos)))
         (locus (list-ref hay-blancos azar))
         )
      (send M set-locus! (car locus) (cdr locus) animat)
      locus
      )
    ))
(ubica-animat A1)
;(ubica-animat A2)
;(send M set-locus! 33 3 A1)             
(provide M)
