Beispiel #1
0
 private void Txt_CorreoE_KeyUp(object sender, KeyEventArgs e)
 {
     if (Txt_CorreoE.Text != "" && Txt_CorreoE.Text != usuario_actual.getCorreo_electronico())
     {
         if (Cerebro.ValidarFormatoCorreo(Txt_CorreoE.Text))
         {
             Lb_Correo.Text      = "Nuevo correo valido y aceptado.";
             Lb_Correo.ForeColor = Color.Green;
             CambioCorreo        = CorreoValido = true;
         }
         else
         {
             Lb_Correo.Text      = "Nuevo correo invalido.";
             Lb_Correo.ForeColor = Color.Red;
             CorreoValido        = false;
             CambioCorreo        = true;
         }
     }
     else
     {
         Lb_Correo.Text = "";
         CambioCorreo   = false;
     }
     UnlockChange();
 }
Beispiel #2
0
 private void Txt_NuevaContraOne_KeyUp(object sender, KeyEventArgs e)
 {
     if (Txt_NuevaContraOne.Text != "")
     {
         if (Cerebro.ValidarFormatoContraseña(Txt_NuevaContraOne.Text))
         {
             Lb_ContraOne.Text      = "Nueva contraseña valida.";
             Lb_ContraOne.ForeColor = Color.Green;
             CambioContraseña       = ContraseñaValida = true;
         }
         else
         {
             Lb_ContraOne.Text      = "Nueva contraseña invalida.";
             Lb_ContraOne.ForeColor = Color.Red;
             ContraseñaValida       = false;
             CambioContraseña       = true;
         }
     }
     else
     {
         Lb_ContraOne.Text   = "";
         Lb_MismaContra.Text = "";
         CambioContraseña    = false;
     }
     UnlockChange();
     SamePassword();
 }
Beispiel #3
0
 private void Txt_NuevaContraseñaOne_KeyUp(object sender, KeyEventArgs e)
 {
     if (Txt_NuevaContraseñaOne.Text != "")
     {
         if (Cerebro.ValidarFormatoContraseña(Txt_NuevaContraseñaOne.Text))
         {
             Lb_ContraseñaOne.Text      = "Formato de contraseña valido.";
             Lb_ContraseñaOne.ForeColor = Color.Green;
             ContraseñaValida           = true;
         }
         else
         {
             Lb_ContraseñaOne.Text      = "Formato de contraseña invalido.";
             Lb_ContraseñaOne.ForeColor = Color.Red;
             ContraseñaValida           = false;
         }
     }
     else
     {
         Lb_ContraseñaOne.Text   = "";
         Lb_MismaContraseña.Text = "";
     }
     CheckSamePassword();
     UnlockButton();
 }
Beispiel #4
0
    private void Awake()
    {
        cerebro   = new Cerebro();
        salidaRed = new float[cantSalidas + cantMemoria];
        memoria   = new float[cantMemoria];
        tick.SetActive(false);
        //redNeuronal = GetComponent<Red>();
        funcionActivacion = new FuncionesActivacion();
        gameController    = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        generaCell        = gameController.GetComponent <GeneraCell>();
        rig         = GetComponent <Rigidbody2D>();
        spriteRen   = GetComponent <SpriteRenderer>();
        color       = GetComponent <SpriteRenderer>().color;
        antena1Ren  = antena1.GetComponent <SpriteRenderer>();
        antena2Ren  = antena2.GetComponent <SpriteRenderer>();
        antena1Coll = antena1.GetComponent <BoxCollider2D>();
        antena2Coll = antena2.GetComponent <BoxCollider2D>();
        // la posicion 10 en realidad esta entre 9.5 y 10.5
        posTile = new Vector2(Mathf.Round(rig.position.x), Mathf.Round(rig.position.y));

        velocidadTiempo = 1;
        InicializaRed();
        IniciarCiclo();
        posInicial = new Vector2(posTile.x, posTile.y);
        SondeoDeLaRed();
        ActualizarDiametro();
    }
Beispiel #5
0
        /// =================================================
        /// <summary>
        /// Creates the neural network with the given configuration
        /// </summary>
        ///
        /// <returns></returns>
        public Cerebro Build()
        {
            if (this.inputNeurons <= 0)
            {
                throw new System.InvalidOperationException(
                          $"The input neuron count is invalid: {this.inputNeurons}"
                          );
            }

            if (this.layerConfigs.Count == 0)
            {
                throw new System.InvalidOperationException("The layer configuration is empty");
            }

            Layer[] layers          = new Layer[this.layerConfigs.Count];
            int     lastNeuronCount = this.inputNeurons;

            for (int i = 0; i < this.layerConfigs.Count; i++)
            {
                LayerConfig config = this.layerConfigs[i];

                IActivator activator;
                switch (config.type)
                {
                case LayerType.Sine:
                    activator = new Sine();
                    break;

                case LayerType.Tanh:
                    activator = new Tanh();
                    break;

                case LayerType.Sigmoid:
                default:
                    activator = new Sigmoid();
                    break;
                }

                layers[i]       = new Layer(lastNeuronCount, config.neuronCount, activator);
                lastNeuronCount = config.neuronCount;
            }

            Cerebro net = new Cerebro(layers);

            if (this.genome != null)
            {
                net.SetGenome(this.genome);
            }
            else
            {
                net.Initialize(this.weightsBiasAmplitude);
            }

            return(net);
        }
Beispiel #6
0
        public ClienteCorre()
        {
            InitializeComponent();
            this.SetBounds(0, 0, this.Width, this.Height);
            HttpChannel canal = new HttpChannel();

            ChannelServices.RegisterChannel(canal, false);
            InicializarObjetoRemoto();
            cerebroJuego = new Cerebro();
            hilo         = new Thread(new ThreadStart(Pulso));
            hilo.Start();
        }
        public ClienteGolpea()
        {
            InitializeComponent();
            this.SetBounds((Screen.GetBounds(this).Width / 2) - (this.Width / 2),
                           (Screen.GetBounds(this).Height / 2) - (this.Height / 2),
                           this.Width,
                           this.Height,
                           BoundsSpecified.Location);
            HttpChannel canal = new HttpChannel();

            ChannelServices.RegisterChannel(canal, false);
            InicializarObjetoRemoto();
            cerebroJuego = new Cerebro();
        }
Beispiel #8
0
        public frmClienteGolpea()
        {
            InitializeComponent();

            // Establece los límites del control en la ubicación y en el tamaño especificados.

            this.SetBounds((Screen.GetBounds(this).Width / 2) - (this.Width / 2), (Screen.GetBounds(this).Height / 2) - (this.Height / 2),
                           this.Width, this.Height, BoundsSpecified.Location);
            // Definimos y registramos un canal para la comunicación
            // Realizamos la configuración del objeto remoto
            HttpChannel canal = new HttpChannel();

            ChannelServices.RegisterChannel(canal, false);
            InicializarObjetoRemoto();
            // Instanciamos un objeto remoto
            cerebroJuego = new Cerebro();
        }
Beispiel #9
0
        public frmClienteCorre()
        {
            InitializeComponent();

            // Establece los límites del control en la ubicación y en el tamaño especificados.
            this.SetBounds(0, 0, this.Width, this.Height);
            // Definimos y registramos un canal para la comunicación
            // Realizamos la configuración del objeto remoto
            HttpChannel canal = new HttpChannel();

            ChannelServices.RegisterChannel(canal, false);
            InicializarObjetoRemoto();
            // Instanciamos un objeto remoto
            cerebroJuego = new Cerebro();
            // Instanciamos el hilo que nos permitira manejar el pulso realizado por el jugador
            hilo = new Thread(new ThreadStart(Pulso));
            hilo.Start();
        }
Beispiel #10
0
    // ============================================
    void Start()
    {
        this.fov = Mathf.Deg2Rad * this.fovInDegrees;

        /**
         *  x
         *  y
         *
         *  see1
         *  wx1
         *  wy1
         *
         *  see1
         *  wx1
         *  wy1
         *
         *  see1
         *  wx1
         *  wy1
         *
         *  seeLeft
         *  wx
         *  wy
         *
         *  seeRight
         *  wx
         *  wy
         *
         */
        // Move to other place
        this.brain = Factory.Create()
                     .WithInput(17)
                     .WithLayer(2, LayerType.Tanh)
                     .WithLayer(1, LayerType.Tanh)
                     .Build();

        this.body = GetComponent <Rigidbody>();

        this.Restart(this.transform.position);

        this.GenerateLookDirections();
    }
Beispiel #11
0
 private void Txt_Contraseña_KeyUp(object sender, KeyEventArgs e)
 {
     if (Txt_Contraseña.Text != "")
     {
         ContraseñaValida = Cerebro.ValidarFormatoContraseña(Txt_Contraseña.Text);
         if (ContraseñaValida)
         {
             Lb_Contraseña.Text      = "Formato de contraseña valido.";
             Lb_Contraseña.ForeColor = Color.Green;
         }
         else
         {
             Lb_Contraseña.Text      = "Formato de contraseña invalido.";
             Lb_Contraseña.ForeColor = Color.Red;
         }
         UnlockButton();
     }
     else
     {
         Lb_Contraseña.Text = "";
     }
 }
Beispiel #12
0
 private void Txt_CorreoE_KeyUp(object sender, KeyEventArgs e)
 {
     if (Txt_CorreoE.Text != "")
     {
         CorreoValido = Cerebro.ValidarFormatoCorreo(Txt_CorreoE.Text);
         if (CorreoValido)
         {
             Lb_Correo.Text      = "Formato de correo valido.";
             Lb_Correo.ForeColor = Color.Green;
         }
         else
         {
             Lb_Correo.Text      = "Formato de correo invalido.";
             Lb_Correo.ForeColor = Color.Red;
         }
         UnlockButton();
     }
     else
     {
         Lb_Correo.Text = "";
     }
 }
Beispiel #13
0
 private void Txt_NuevoCorreo_KeyUp(object sender, KeyEventArgs e)
 {
     if (Txt_NuevoCorreo.Text != "")
     {
         if (Cerebro.ValidarFormatoCorreo(Txt_NuevoCorreo.Text))
         {
             Lb_Correo.Text      = "Formato de correo valido.";
             Lb_Correo.ForeColor = Color.Green;
             CorreoValido        = true;
         }
         else
         {
             Lb_Correo.Text      = "Formato de correo invalido.";
             Lb_Correo.ForeColor = Color.Red;
             CorreoValido        = false;
         }
     }
     else
     {
         Lb_Correo.Text = "";
     }
     UnlockButton();
 }
Beispiel #14
0
        public Direcao ObterAcao()
        {
            List <double> entradas = new List <double>();

            foreach (var sensor in this.Sensores)
            {
                entradas.Add(Convert.ToDouble(sensor.VerSaida));
                entradas.Add(Convert.ToDouble(sensor.Parede));
                entradas.Add(Convert.ToDouble(sensor.JaPassou));
            }

            Cerebro.AdicionarValoresParaEntradas(entradas.ToArray());
            Cerebro.FuncionarRede();
            var resultado = Cerebro.ObterResultado();
            var maior     = resultado.Max();
            var index     = resultado.IndexOf(maior);
            var direcao   = (Direcao)index;

            if (direcao == Direcao.CtrlZ)
            {
                direcao = ObterDirecaoCtrlZ();
            }
            else
            {
                PonteiroVolta = -1;
            }

            Historico.Add(PontoReferencia);

            switch (direcao)
            {
            case Direcao.Esquerda:
                PontoReferencia = new Point(PontoReferencia.X - 1, PontoReferencia.Y);
                break;

            case Direcao.Cima:
                PontoReferencia = new Point(PontoReferencia.X, PontoReferencia.Y - 1);
                break;

            case Direcao.Direita:
                PontoReferencia = new Point(PontoReferencia.X + 1, PontoReferencia.Y);
                break;

            case Direcao.Baixo:
                PontoReferencia = new Point(PontoReferencia.X, PontoReferencia.Y + 1);
                break;

            default:
                break;
            }

            /*if (direcao == Direcao.Esquerda && Sensores[0].Parede)
             *  throw new Exception("Fuuuu!!");
             *
             * if (direcao == Direcao.Cima && Sensores[1].Parede)
             *  throw new Exception("Fuuuu!!");
             *
             * if (direcao == Direcao.Direita && Sensores[2].Parede)
             *  throw new Exception("Fuuuu!!");
             *
             * if (direcao == Direcao.Baixo && Sensores[3].Parede)
             *  throw new Exception("Fuuuu!!");*/

            return(direcao);
        }
Beispiel #15
0
    // =======================================
    void Awake()
    {
        // Sensor data

        /**
         * x
         * y
         * health_percent
         * Can shoot
         * forward_x
         * forward_y
         *
         * eye_active
         * eye_x
         * eye_y
         *  .
         *  . drive by eyeCount
         *  .
         * hit_from_active
         * hit_from_x
         * hit_from_y
         */
        this.eyes = new Vector3[this.eyeCount];

        this.sensorBuffer = new NameIndexedBuffer();

        this.sensorBuffer.AddIndex("time", 1);
        this.sensorBuffer.AddIndex("position", 2);
        this.sensorBuffer.AddIndex("health", 1);
        this.sensorBuffer.AddIndex("shoot_time", 1);
        this.sensorBuffer.AddIndex("forward", 2);

        for (int i = 0; i < this.eyeCount; i++)
        {
            this.sensorBuffer.AddIndex($"eye_{i}", 3);
        }

        this.sensorBuffer.AddIndex("hit_from", 3);

        // Reaction data

        /**
         * forward
         * backwards
         * turn left
         * turn right
         * shoot
         */
        this.reaction = new float[5];

        this.brain = BrainFactory.Create()
                     .WithInput(this.sensorBuffer.size)
                     .WithLayer(16, LayerType.Tanh)
                     .WithLayer(8, LayerType.Tanh)
                     .WithLayer(this.reaction.Length, LayerType.Sigmoid)
                     .WithWeightBiasAmplitude(10f)
                     .Build();

        this.physics          = GetComponent <Rigidbody>();
        this.positionRecorder = GetComponent <PositionRecorder>();
        this.lookToFriend     = new FloatRecorder();
        this.lookToFoe        = new FloatRecorder();
    }