Exemple #1
0
        public Fish(Fish other, double rndAmount)
        {
            SetupSight();
            Brain = new Neural.Brain(other.Brain);
            Brain.Randomize(rndAmount);
            rndAmount /= 5.0;
            Color      = new Vector4(MathUtil.Clamp(other.Color.X + Util.RndFloat(-(float)rndAmount, (float)rndAmount), 0.0f, 1.0f), MathUtil.Clamp(other.Color.Y + Util.RndFloat(-(float)rndAmount, (float)rndAmount), 0.0f, 1.0f), MathUtil.Clamp(other.Color.Z + Util.RndFloat(-(float)rndAmount, (float)rndAmount), 0.0f, 1.0f), 1.0f);

            //Temp
            var mag = Color.X * Color.X + Color.Y * Color.Y + Color.Z * Color.Z;

            mag   = (float)Math.Sqrt(mag);
            Color = new Vector4(Color.X / mag, Color.Y / mag, Color.Z / mag, Color.W);
            //====

            MeshIndex = Util.RndInt(0, 3);
        }
Exemple #2
0
        public Fish(string filename)
        {
            SetupSight();
            Brain = new Neural.Brain(4);
            Brain.FullyConnect(5 + 5 * 4 + 1, 30, 15, 2);
            Brain.ReadWeights(filename);

            Color = new Vector4(Util.RndFloat(0, 1), Util.RndFloat(0, 1), Util.RndFloat(0, 1), 1.0f);

            //Temp
            var mag = Color.X * Color.X + Color.Y * Color.Y + Color.Z * Color.Z;

            mag   = (float)Math.Sqrt(mag);
            Color = new Vector4(Color.X / mag, Color.Y / mag, Color.Z / mag, Color.W);
            //====

            MeshIndex = Util.RndInt(0, 3);
        }
Exemple #3
0
 internal void Randomize()
 {
     Brain = new Neural.Brain(4);
     Brain.FullyConnect(5 + 5 * 4 + 1, 30, 15, 2);
     Brain.Randomize(1);
 }