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); }
internal void Randomize() { Brain = new Neural.Brain(4); Brain.FullyConnect(5 + 5 * 4 + 1, 30, 15, 2); Brain.Randomize(1); }