private Efloy Mate() {

		int MomID, DadID, BreedTryMax, BreedTry ;
		Efloy Mom, Dad , Kid;
		String KidChrom, fx, ev;
		BreedTryMax = 10;
                BreedTry = 0;
		MomID = GetParentID();
		DadID = GetParentID();
		Mom = Efloys[GetFloyNumber(MomID)];
		Dad = Efloys[GetFloyNumber(DadID)];

		//if (Mom.type == 0) {
		//	while (Mom.type == 0) {
		//		MomID = GetParentID();
		//		Mom = Efloys[GetFloyNumber(MomID)];
			//	deb.showMsg("Repeating Mom = "+MomID);
		//	}
		//}

		//if (Dad.type == 0) {
		//	while (Dad.type == 0) {
		//		DadID = GetParentID();
		//		Dad = Efloys[GetFloyNumber(DadID)];
		//	//	deb.showMsg("Repeating Dad = "+DadID);
		//	}
		//}
                //
              if (Dad.color != Mom.color ) {
                  while  ( (BreedTry + 1) > BreedTryMax ) {
                        BreedTry = BreedTry++ ;
                        DadID = GetParentID();
                        Dad = Efloys[GetFloyNumber(DadID)];
                        if (Dad.color == Mom.color ) {
                            BreedTry = BreedTryMax;
                        }
                   }
              }

              if (Mom.type > 0 ) {
                if (Mom.color == Dad.color ) {
                    KidChrom = Dad.CrossOver(Mom.chrom);
                    fx = EncodeChrom(fixpars);
                    ev = EncodeChrom(envpars);
                    Kid = new Efloy(params, KidChrom, fixpars, fx, envpars, ev);
                    // Kid.chrom = Kid.mutate();
                    //if (Kid.color == Color.green)
                     	// Kid.AssignColor(Mom.GetColorNumber());
                    //  else
		    //	Kid.AssignColor(Dad.GetColorNumber());

                    /* Kid.energy = (int) ((Dad.energy + Mom.energy)/2);
                    Kid.safety = (int) ((Dad.safety + Mom.safety)/2);
                    // Dad.energy = (int) (Dad.energy - Dad.MaxEnergyDose );
                    Kid.cooperation = (int) ((Dad.cooperation + Mom.cooperation)/2); 
                     */
                    Kid.energy = (int) ((Dad.energy));
                    Kid.safety = (int) ((Mom.safety));
                    Kid.cooperation = (int) ((Mom.cooperation)); 
                     
                    Kid.GetFitness();
                    Kid.x = Mom.x;
                    Kid.y = Mom.y;
                }
                else {
                     Kid = Efloys[GetFloyNumber(MomID)];
                     // Kid.safety = (int) (Kid.safety - Kid.MaxSafetyDose);
                     // Kid.energy = (int) (Kid.energy + Kid.MaxEnergyDose );
                     Kid.x = Mom.x;
                     Kid.y = Mom.y;
                     Kid.vx = Mom.vx;
                     Kid.vy = Mom.vy;
                          
                }
              }else {
                    Kid = Efloys[GetFloyNumber(MomID)];
                     // Kid.safety = (int) (Kid.safety + Kid.MaxSafetyDose);
                     // Kid.energy = (int) (Kid.energy + Kid.MaxEnergyDose );
                    // Kid.DistLocalFactor = 1;
		    // Kid.CollisionLocalFactor = -1;
                     Kid.x = Mom.x;
                     Kid.y = Mom.y;
                     Kid.vx = Mom.vx;
                     Kid.vy = Mom.vy;
                }
                // canvas.repaint();  //  ajd

		/*
		deb.showMsg("---");
		deb.showMsg("SumFitness = "+SumFitness);
		deb.showMsg("Mom = "+MomID+": "+Mom.chrom+" Fit= "+Mom.fitness);
		deb.showMsg("Dad = "+DadID+": "+Dad.chrom+" Fit= "+Dad.fitness);
		deb.showMsg("Kid = "+KidChrom+" Kid.chrom= "+Kid.chrom);
		*/

		return Kid;

	}