public void Spawn()
        {
            if (plant_turtles.Count() > 500)
            {
                return;
            }
            Random rnd = new Random();
            List <Plant_Turtle> new_turtles = new List <Plant_Turtle>();

            foreach (Plant_Turtle individual_turtle in plant_turtles)
            {
                int locx = individual_turtle.location_x;
                int locy = individual_turtle.location_y;
                if (waterMap[locx, locy].val < 20 && waterMap[locx, locy].val > 5)
                {
                    Plant_Turtle newplant = new Plant_Turtle(locx, locy, rnd.NextDouble() * 360.0, this);
                    new_turtles.Add(newplant);
                }
            }
            plant_turtles.AddRange(new_turtles);
        }
        public void MoveTurtles()
        {
            List <Plant_Turtle> alive_turtles = (from turtle in plant_turtles where turtle.alive select turtle).ToList();

            plant_turtles = alive_turtles;

            foreach (Plant_Turtle individual in plant_turtles) // still need to add in the alive function above
            {
                //int counter = 0;
                //double valuex = 0.0;
                //double valuey = 0.0;
                //double factorplant = 1.0;
                //double factorwater = 2.0;
                //int originx = individual.location_x;
                //int originy = individual.location_y;
                //double weightages = 0.0;

                //for (int xcor = originx - (plantMap.xLen/5); xcor < originx + (plantMap.xLen / 5); xcor++)
                //{
                //    if (xcor < plantMap.yLen - 1 && xcor > 0 && xcor != originx)
                //    {
                //        for (int ycor = originy - (plantMap.xLen / 5); ycor < originy + (plantMap.xLen / 5); ycor++)
                //        {
                //            if (ycor < plantMap.yLen - 1 && ycor > 0 && ycor != originy)
                //            {
                //                double distancesquare = Math.Pow(xcor - originx, 2) + Math.Pow(ycor - originy, 2);
                //                valuex += factorplant * (1.0 / distancesquare) *(plantMap[xcor,ycor].val* factorplant + waterMap[xcor, ycor].val * factorwater) *(xcor - originx);
                //                valuey += factorplant * (1.0 / distancesquare) * (plantMap[xcor, ycor].val * factorplant + waterMap[xcor, ycor].val * factorwater) * (ycor - originy);
                //                weightages += (plantMap[xcor, ycor].val + waterMap[xcor, ycor].val);
                //                counter += 1;
                //            }

                //        }
                //    }

                //}

                //Are conditions to find new target met?
                if (individual.target_x == -1 || individual.target_y == -1 || (individual.target_x == individual.location_x && individual.target_y == individual.location_y))
                {
                    int tx, ty;
                    Plant_Turtle.FindNewTarget(waterMap.bestWater, out tx, out ty);
                    individual.target_x = tx;
                    individual.target_y = ty;
                }

                //Throw dice to determine if individual should head straight for the target or move towards a patch.
                Random r = new Random(15528);
                if (r.NextDouble() < Plant_Turtle.patchBias)
                {
                    individual.MoveTowardsPatch(plantMap.desired_plants);
                }
                else
                {
                    individual.MoveTowardsTarget();
                }

                //Vector2d direction_vector = new Vector2d(valuex / weightages, valuey / counter); //directional vector to face
                //if (plantMap.desired_plants.Count() > 0)
                //{
                //    for (int patch = 0; patch<plantMap.desired_plants.Count(); patch++)
                //    {
                //        direction_vector.X += .5 * (plantMap.desired_plants[patch].locX-originx);
                //        direction_vector.Y += 5 * (plantMap.desired_plants[patch].locY-originy);
                //    }
                //}
                //double initial_heading = Math.Atan(direction_vector.X/direction_vector.Y);
                //direction_vector.Unitize();
                //double locX = individual.location_x;
                //double locY = individual.location_y;
                //locX += direction_vector.X;
                //locY += direction_vector.Y;
                //locX = Math.Round(locX);
                //locY = Math.Round(locY);

                //individual.location_x = (int)locX;
                //individual.location_y = (int)locY;

                //if (individual.location_x < 0)
                //{
                //    individual.location_x = 0;
                //}
                //if (individual.location_x > plantMap.xLen-1)
                //{
                //    individual.location_x = plantMap.xLen - 1;
                //}
                //if (individual.location_y < 0)
                //{
                //    individual.location_y = 0;
                //}
                //if (individual.location_y > plantMap.yLen - 1)
                //{
                //    individual.location_y = plantMap.yLen - 1;
                //}
            }
        }