Esempio n. 1
0
        public void act()
        {
            energy = DudeMath.constrain(energy + world.energy, 0, 1);
            charge = DudeMath.constrain(charge + world.charge, 0, 1);
            //eyeAngle = DudeMath.constrain(eyeAngle + (outs[(int)nnOutputs.eyeAngle] * 0.01), 0, 2);
            //focus = DudeMath.map (outs [(int)nnOutputs.eyeAngle], -1, 1, 0, 2);
            red   = DudeMath.map(outs [(int)nnOutputs.colorR], -1, 1, 0, 1);
            green = DudeMath.map(outs [(int)nnOutputs.colorG], -1, 1, 0, 1);
            blue  = DudeMath.map(outs [(int)nnOutputs.colorB], -1, 1, 0, 1);
//			red = 1;
//			green = 0;
//			blue = 0;
        }
Esempio n. 2
0
        public Dude()
        {
            double r = world.radius;

            Vector point = new Vector(DudeMath.map(random.NextDouble(), 0, 1, -r, r),
                                      DudeMath.map(random.NextDouble(), 0, 1, -r, r));

            while ((point - spacials.pos).Length > world.radius)
            {
                point = new Vector(DudeMath.map(random.NextDouble(), 0, 1, -r, r),
                                   DudeMath.map(random.NextDouble(), 0, 1, -r, r));
            }

            spacials.angle = DudeMath.map(random.NextDouble(), 0, 1, -Math.PI, Math.PI);

            teleport(point);
        }
Esempio n. 3
0
        public void doThrusters()
        {
            thrusters[0, 0] = DudeMath.wrapPi(thrusters[0, 0] + (outs[(int)nnOutputs.thrusterA0] * 0.1));
            thrusters[1, 0] = DudeMath.wrapPi(thrusters[1, 0] + (outs[(int)nnOutputs.thrusterA1] * 0.1));
            thrusters[2, 0] = DudeMath.wrapPi(thrusters[2, 0] + (outs[(int)nnOutputs.thrusterA2] * 0.1));
            thrusters[3, 0] = DudeMath.wrapPi(thrusters[3, 0] + (outs[(int)nnOutputs.thrusterA3] * 0.1));


            thrusters[0, 1] = DudeMath.map(outs [(int)nnOutputs.thrusterT0], -1, 1, 0, 1);
            thrusters[1, 1] = DudeMath.map(outs [(int)nnOutputs.thrusterT1], -1, 1, 0, 1);
            thrusters[2, 1] = DudeMath.map(outs [(int)nnOutputs.thrusterT2], -1, 1, 0, 1);
            thrusters[3, 1] = DudeMath.map(outs [(int)nnOutputs.thrusterT3], -1, 1, 0, 1);


            for (int i = 0; i < 4; i++)
            {
                //double angle = DudeMath.wrapPi (spacials.angle + thrusters [i,0]);

                //spacials.pos.X += Math.Sin (angle) * thrusters[i,1] * 1;
                //spacials.pos.Y += Math.Cos (angle) * thrusters[i,1] * 1;
            }
        }