public Tree(Vector Pos, VectorI ChunkPos, float StartEnergy = 5)
        {
            Col           = Color.SaddleBrown;
            LeafColor     = Color.ForestGreen;
            BranchColor   = Color.SaddleBrown;
            this.Pos      = Pos;
            this.ChunkPos = ChunkPos;
            Timer         = Form1.Rand.Next(MaxTimer);
            Energy        = StartEnergy;
            //Inputs: TreeAge,TreeEnergy,IsBranch,Layer,ChildBranches,ChildLeaves,LocalEnergy(if branch sum of all children),LocalAge,HasFlower,FruitRatio
            //Outputs: SpawnLeaf(if below -1, drop instead),LeafAngle1,LeafAngle2,LeafAngle3,SpawnBranch,BranchAngle1,BranchAngle2,ThickerBranch,LongerBranch,SpawnSeed,SpawnFlower,FruitRate
            int InputCount  = 10;
            int OutputCount = 12;

            NeuralNetwork = new FeedForwardNetwork(InputCount, OutputCount, 8, 1, NeuralNetwork.OutputType.Linear);
            Inputs        = new float[InputCount];
            FeedForwardNetwork N = NeuralNetwork as FeedForwardNetwork;

            /*for (int i = 0; i < N.WeightMatrix[0].Length; i++)
             * {
             *  N.WeightMatrix[0][i][0] = 0;
             * }
             * for (int i = 0; i < N.WeightMatrix[1].Length; i++)
             * {
             *  N.WeightMatrix[1][i][9] = 0;
             * }*/

            /*N.WeightMatrix[N.ToIndex(0,3,0)] = 0.1f;
             * N.WeightMatrix[N.ToIndex(0, 1, 0)] = 2;
             * N.WeightMatrix[N.ToIndex(0, 10, 0)] = -2;
             * N.WeightMatrix[N.ToIndex(1, 0, 9)] = 1;
             *
             * //N.WeightMatrix[0][0][0] = 1;
             * N.WeightMatrix[N.ToIndex(0, 5, 1)] = -1;
             * N.WeightMatrix[N.ToIndex(0, 3, 1)] = -0.5f;
             * N.WeightMatrix[N.ToIndex(0, 10, 1)] = -0.3f;
             * N.WeightMatrix[N.ToIndex(0, 1, 1)] = 1;
             * N.WeightMatrix[N.ToIndex(1, 1, 0)] = 1;
             * N.WeightMatrix[N.ToIndex(1, 1, 4)] = 1;
             *
             * N.WeightMatrix[N.ToIndex(0, 6, 2)] = 2;
             * N.WeightMatrix[N.ToIndex(1, 8, 1)] = 0.5f;
             * N.WeightMatrix[N.ToIndex(1, 2, 2)] = 2f;
             *
             * //N.WeightMatrix[1][8][9] = -1f;
             *
             * N.Mutate(MutationRate);*/
            N.GenerateRandom(-2, 2);

            Root = new Branch(this, null, 3, 0, 0);
            AddLeaf(Root, new Leaf(Root, 40, Form1.Rand.Next(0, 360), 0));
            Branches.Add(Root);

            UpdateArea();
        }
 public FeedForwardNetwork(FeedForwardNetwork OldNetwork)
 {
     InputCount  = OldNetwork.InputCount;
     OutputCount = OldNetwork.OutputCount;
     NeuronCount = OldNetwork.NeuronCount;
     Layers      = OldNetwork.Layers;
     outputType  = new OutputType[OldNetwork.outputType.Length];
     OldNetwork.outputType.CopyTo(outputType, 0);
     Neurons      = new float[Layers][];
     WeightMatrix = new float[OldNetwork.WeightMatrix.Length];
     for (int i = 0; i < Neurons.Length; i++)
     {
         Neurons[i] = new float[OldNetwork.Neurons[i].Length];
     }
     for (int i = 0; i < WeightMatrix.Length; i++)
     {
         WeightMatrix[i] = OldNetwork.WeightMatrix[i];
     }
 }