Index: cpp/frams/genetics/f9/conv_f9.cpp
===================================================================
--- cpp/frams/genetics/f9/conv_f9.cpp	(revision 167)
+++ cpp/frams/genetics/f9/conv_f9.cpp	(revision 168)
@@ -13,5 +13,5 @@
 {
 	name = "Turtle3D-ortho encoding";
-	in_format  = '9';
+	in_format = '9';
 	out_format = '0';
 	mapsupport = 0; //would be easy and nice to add!
@@ -19,5 +19,5 @@
 
 
-const char* turtle_commands_f9 ="LRDUBF";
+const char* turtle_commands_f9 = "LRDUBF";
 
 //const char* turtle_commandsX_f9="-+0000";
@@ -31,18 +31,18 @@
 	Model m;
 	m.open();
-	int recently_added=addSegment(m,vertices,current,0xDead);
-	for(int i=0;i<in.len();i++)
+	int recently_added = addSegment(m, vertices, current, 0xDead);
+	for (int i = 0; i < in.len(); i++)
 	{
-		char command=in[i];
-		char *ptr=strchr((char*)turtle_commands_f9,command);
+		char command = in[i];
+		char *ptr = strchr((char*)turtle_commands_f9, command);
 		if (ptr)
 		{
-			int delta[]={0,0,0};
-			int pos=ptr-turtle_commands_f9;
-			int axis=pos/2;
-			int dir=pos%2;
-			(*(delta+axis))+=dir*2-1; //+1 or -1 in the given axis
+			int delta[] = { 0, 0, 0 };
+			int pos = ptr - turtle_commands_f9;
+			int axis = pos / 2;
+			int dir = pos % 2;
+			(*(delta + axis)) += dir * 2 - 1; //+1 or -1 in the given axis
 			current.add(delta);
-			recently_added=addSegment(m,vertices,current,recently_added);
+			recently_added = addSegment(m, vertices, current, recently_added);
 		}
 	}
@@ -57,21 +57,22 @@
 }
 
-int GenoConv_f90::addSegment(Model &m,vector<XYZ_LOC> &vertices,const XYZ_LOC &new_vertex,int recently_added)
+int GenoConv_f90::addSegment(Model &m, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex, int recently_added)
 {
-	if (vertices.size()<1) //empty model?
+	if (vertices.size() < 1) //empty model?
 	{
-		return addNewVertex(m,vertices,new_vertex);
-	} else
+		return addNewVertex(m, vertices, new_vertex);
+	}
+	else
 	{
-		int vertex_here=findVertexAt(vertices,new_vertex);
-		if (vertex_here<0) //need to create a new Part
+		int vertex_here = findVertexAt(vertices, new_vertex);
+		if (vertex_here < 0) //need to create a new Part
 		{
-			vertex_here=addNewVertex(m,vertices,new_vertex);
+			vertex_here = addNewVertex(m, vertices, new_vertex);
 		} //else there already exists a Part in new_vertex; new Joint may or may not be needed
-		Part *p1=m.getPart(recently_added);
-		Part *p2=m.getPart(vertex_here);
-		if (m.findJoint(p1,p2)<0 && m.findJoint(p2,p1)<0) //new Joint needed? should always be true if we just created a new Part (vertex_here was <0)
+		Part *p1 = m.getPart(recently_added);
+		Part *p2 = m.getPart(vertex_here);
+		if (m.findJoint(p1, p2) < 0 && m.findJoint(p2, p1) < 0) //new Joint needed? should always be true if we just created a new Part (vertex_here was <0)
 		{
-			m.addNewJoint(p1,p2);
+			m.addNewJoint(p1, p2);
 		}
 		return vertex_here;
@@ -79,7 +80,7 @@
 }
 
-int GenoConv_f90::findVertexAt(vector<XYZ_LOC> &vertices,const XYZ_LOC &vertex)
+int GenoConv_f90::findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &vertex)
 {
-	for(int i=0;i<vertices.size();i++)
+	for (int i = 0; i < vertices.size(); i++)
 		if (vertices[i].same_coordinates(vertex)) return i;
 	return -1;
@@ -87,26 +88,26 @@
 
 
-int GenoConv_f90::addNewVertex(Model &m,vector<XYZ_LOC> &vertices,const XYZ_LOC &new_vertex)
+int GenoConv_f90::addNewVertex(Model &m, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex)
 {
-	Part *p=new Part;
-	p->p.x=new_vertex.x;
-	p->p.y=new_vertex.y;
-	p->p.z=new_vertex.z;
+	Part *p = new Part;
+	p->p.x = new_vertex.x;
+	p->p.y = new_vertex.y;
+	p->p.z = new_vertex.z;
 	m.addPart(p);
 
 	vertices.push_back(new_vertex);
-	return vertices.size()-1;
+	return vertices.size() - 1;
 }
 
-double mix(int *colortab,int maxind,double ind)
+double mix(int *colortab, int maxind, double ind)
 {
-	int indpre=(int)ind;
-	int indpost=indpre+1;
-	if (indpost>maxind) indpost=maxind;
-	int v1=colortab[indpre];
-	int v2=colortab[indpost];
-	double d1=ind-indpre;
-	double d2=indpost-ind;
-	double v=indpre==indpost?v1:d2*v1+d1*v2; //d1+d2==1
+	int indpre = (int)ind;
+	int indpost = indpre + 1;
+	if (indpost > maxind) indpost = maxind;
+	int v1 = colortab[indpre];
+	int v2 = colortab[indpost];
+	double d1 = ind - indpre;
+	double d2 = indpost - ind;
+	double v = indpre == indpost ? v1 : d2*v1 + d1*v2; //d1+d2==1
 	return v;
 }
@@ -115,33 +116,33 @@
 {
 	//a rainbow on Joints: from the first one red, through middle green, to blue or violet - last
-	static int r[]={1,1,0,0,0,1};
-	static int g[]={0,1,1,1,0,0};
-	static int b[]={0,0,0,1,1,1};
-	int maxind=ARRAY_LENGTH(r)-1;
+	static int r[] = { 1, 1, 0, 0, 0, 1 };
+	static int g[] = { 0, 1, 1, 1, 0, 0 };
+	static int b[] = { 0, 0, 0, 1, 1, 1 };
+	int maxind = ARRAY_LENGTH(r) - 1;
 
-	int joints_count=m.getJointCount();
-	for(int i=0;i<joints_count;i++)
+	int joints_count = m.getJointCount();
+	for (int i = 0; i < joints_count; i++)
 	{
-		Joint *j=m.getJoint(i);
-		double x=joints_count<2?0:(double)i/(joints_count-1); //0..1, postion in the rainbow
-		double ind=x*maxind;
-		j->vcolor.x=mix(r,maxind,ind);
-		j->vcolor.y=mix(g,maxind,ind);
-		j->vcolor.z=mix(b,maxind,ind);
+		Joint *j = m.getJoint(i);
+		double x = joints_count < 2 ? 0 : (double)i / (joints_count - 1); //0..1, postion in the rainbow
+		double ind = x*maxind;
+		j->vcolor.x = mix(r, maxind, ind);
+		j->vcolor.y = mix(g, maxind, ind);
+		j->vcolor.z = mix(b, maxind, ind);
 	}
 
-	int parts_count=m.getPartCount();
+	int parts_count = m.getPartCount();
 	SList jlist;
-	for(int i=0;i<parts_count;i++)
+	for (int i = 0; i<parts_count; i++)
 	{
-		Part *p=m.getPart(i);
+		Part *p = m.getPart(i);
 		jlist.clear();
-		int count=m.findJoints(jlist,p);
-		Pt3D averagecolor(0,0,0); //Parts will get averaged colors from all attached Joints
-		FOREACH(Joint*,j,jlist)
-			averagecolor+=j->vcolor;
-		if (count>5) count=5; //avoid too fat...
-		p->vsize=0.3+count/15.0; //the more Joints is attached to a Part, the fatter it is
-		p->vcolor=averagecolor/count;
+		int count = m.findJoints(jlist, p);
+		Pt3D averagecolor(0, 0, 0); //Parts will get averaged colors from all attached Joints
+		FOREACH(Joint*, j, jlist)
+			averagecolor += j->vcolor;
+		p->vcolor = averagecolor / count;
+		if (count>5) count = 5; //avoid too fat...
+		p->vsize = 0.3 + count / 15.0; //the more Joints is attached to a Part, the fatter it is
 	}
 }
@@ -149,13 +150,13 @@
 void GenoConv_f90::perturbPartLocations(Model &m) //deterministic "body noise", see APPLY_DETERMINISTIC_BODY_NOISE
 {
-	for(int i=0;i<m.getPartCount();i++)
+	for (int i = 0; i < m.getPartCount(); i++)
 	{
-		Part *p=m.getPart(i);
+		Part *p = m.getPart(i);
 		Pt3D noise(
-			((i+1)  %10)-4.5  ,
-			((3*i+5)%10)-4.5  ,
-			((7*i+2)%10)-4.5
+			((i + 1) % 10) - 4.5,
+			((3 * i + 5) % 10) - 4.5,
+			((7 * i + 2) % 10) - 4.5
 			); //-4.5 .. 4.5 in each axis
-		p->p+=noise/1000;
+		p->p += noise / 1000;
 	}
 }
Index: cpp/frams/genetics/f9/oper_f9.cpp
===================================================================
--- cpp/frams/genetics/f9/oper_f9.cpp	(revision 167)
+++ cpp/frams/genetics/f9/oper_f9.cpp	(revision 168)
@@ -9,9 +9,9 @@
 
 #define FIELDSTRUCT GenoOper_f9
-static ParamEntry GENOf9param_tab[]=
+static ParamEntry GENOf9param_tab[] =
 {
-	{"Genetics: f9",1,1,},
-	{"f9_mut",0,0,"Mutation probability","f 0 1 0.1",FIELD(mut_prob),"How many genes should be mutated during single mutation (1=all genes, 0.1=ten percent)",},
-	{0,},
+	{ "Genetics: f9", 1, 1, },
+	{ "f9_mut", 0, 0, "Mutation probability", "f 0 1 0.1", FIELD(mut_prob), "How many genes should be mutated during single mutation (1=all genes, 0.1=ten percent)", },
+	{ 0, },
 };
 #undef FIELDSTRUCT
@@ -23,5 +23,5 @@
 	par.select(this);
 	par.setDefault();
-	supported_format='9';
+	supported_format = '9';
 }
 
@@ -29,8 +29,8 @@
 {
 	if (!gene[0]) return 1; //empty is not valid
-	bool ok=true;
+	bool ok = true;
 	int i;
-	for(i=0;i<strlen(gene);i++) if (!strchr(turtle_commands_f9,gene[i])) {ok=false; break;}
-	return ok ? GENOPER_OK : i+1;
+	for (i = 0; i < strlen(gene); i++) if (!strchr(turtle_commands_f9, gene[i])) { ok = false; break; }
+	return ok ? GENOPER_OK : i + 1;
 }
 
@@ -39,69 +39,70 @@
 {
 	SString validated; //new genotype (everything except turtle_commands_f9 is skipped)
-	for(int i=0;i<strlen(gene);i++)
-		if (strchr(turtle_commands_f9,gene[i])) validated+=gene[i];  //validated contains only turtle_commands_f9
+	for (int i = 0; i < strlen(gene); i++)
+		if (strchr(turtle_commands_f9, gene[i])) validated += gene[i];  //validated contains only turtle_commands_f9
 	free(gene);
-	gene=strdup(validated); //reallocate
+	gene = strdup(validated); //reallocate
 	return GENOPER_OK;
 }
 
 ///Very simple mutation
-int GenoOper_f9::mutate(char *&gene,float &chg,int &method)
+int GenoOper_f9::mutate(char *&gene, float &chg, int &method)
 {
-	method=0;
-	int changes=0,len=strlen(gene);
-	int symbols=strlen(turtle_commands_f9);
+	method = 0;
+	int changes = 0, len = strlen(gene);
+	int symbols = strlen(turtle_commands_f9);
 
-	for(int i=0;i<len;i++)
+	for (int i = 0; i < len; i++)
 	{
-		if (rnd01<mut_prob) //normalize prob with the length of the genotype
+		if (rnd01 < mut_prob) //normalize prob with the length of the genotype
 		{
-			char oldgene=gene[i];
-			gene[i]=turtle_commands_f9[randomN(symbols)];
-			if (gene[i]!=oldgene) changes++;
+			char oldgene = gene[i];
+			gene[i] = turtle_commands_f9[randomN(symbols)];
+			if (gene[i] != oldgene) changes++;
 		}
 	}
 
-	if (rnd01<mut_prob) //add or delete a random char
+	if (rnd01 < mut_prob) //add or delete a random char
 	{
 		SString newgeno(gene);
-		if (randomN(2)==0) //add
+		if (randomN(2) == 0) //add
 		{
-			int symbols=strlen(turtle_commands_f9);
-			int p=randomN(len+1);  //random location
+			int symbols = strlen(turtle_commands_f9);
+			int p = randomN(len + 1);  //random location
 			//printf("before add: %s\n",(const char*)newgeno);
-			newgeno=newgeno.substr(0,p)+SString(turtle_commands_f9+randomN(symbols),1)+newgeno.substr(p);
+			newgeno = newgeno.substr(0, p) + SString(turtle_commands_f9 + randomN(symbols), 1) + newgeno.substr(p);
 			//printf("after add: %s\n",(const char*)newgeno);
 			changes++;
-		} else if (len>1) //delete
+		}
+		else if (len > 1) //delete
 		{
-			int p=randomN(len);  //random location
+			int p = randomN(len);  //random location
 			//printf("before delete: %s\n",(const char*)newgeno);
-			newgeno=newgeno.substr(0,p)+newgeno.substr(p+1);
+			newgeno = newgeno.substr(0, p) + newgeno.substr(p + 1);
 			//printf("after delete: %s\n",(const char*)newgeno);
 			changes++;
 		}
 		free(gene);
-		gene=strdup(newgeno); //reallocate
+		gene = strdup(newgeno); //reallocate
 	}
 
-	chg=(float)changes/len;
-	return changes>0?GENOPER_OK:GENOPER_OPFAIL; //no changes => OPFAIL so that genman will call mutate again
+	chg = (float)changes / len;
+	return changes > 0 ? GENOPER_OK : GENOPER_OPFAIL; //no changes => OPFAIL so that GenMan will call mutate again
 }
 
 ///A simple one-point crossover
-int GenoOper_f9::crossOver(char *&g1,char *&g2,float& chg1,float& chg2)
+int GenoOper_f9::crossOver(char *&g1, char *&g2, float& chg1, float& chg2)
 {
-	int len1=strlen(g1),len2=strlen(g2);
-	int p1=randomN(len1);  //random cut point for first genotype
-	int p2=randomN(len2);  //random cut point for second genotype
-	char *child1=(char*)malloc(p1+len2-p2+1);
-	char *child2=(char*)malloc(p2+len1-p1+1);
-	strncpy(child1,g1,p1);   strcpy(child1+p1,g2+p2);
-	strncpy(child2,g2,p2);   strcpy(child2+p2,g1+p1);
-	free(g1); g1=child1;
-	free(g2); g2=child2;
-	chg1=(float)p1/strlen(child1);
-	chg2=(float)p2/strlen(child2);
+	int len1 = strlen(g1), len2 = strlen(g2);
+	int p1 = randomN(len1);  //random cut point for first genotype
+	int p2 = randomN(len2);  //random cut point for second genotype
+	char *child1 = (char*)malloc(p1 + len2 - p2 + 1);
+	char *child2 = (char*)malloc(p2 + len1 - p1 + 1);
+	strncpy(child1, g1, p1);   strcpy(child1 + p1, g2 + p2);
+	strncpy(child2, g2, p2);   strcpy(child2 + p2, g1 + p1);
+	free(g1); g1 = child1;
+	free(g2); g2 = child2;
+	chg1 = (float)p1 / strlen(child1);
+	chg2 = (float)p2 / strlen(child2);
 	return GENOPER_OK;
 }
@@ -110,12 +111,12 @@
 unsigned long GenoOper_f9::style(const char *g, int pos)
 {
-	char ch=g[pos];
-	unsigned long style=GENSTYLE_CS(0,GENSTYLE_INVALID); //default, should be changed below
-	char *ptr=strchr((char*)turtle_commands_f9,ch);
+	char ch = g[pos];
+	unsigned long style = GENSTYLE_CS(0, GENSTYLE_INVALID); //default, should be changed below
+	char *ptr = strchr((char*)turtle_commands_f9, ch);
 	if (ptr)
 	{
-		int pos=ptr-turtle_commands_f9;
-		int axis=pos/2;
-		style=GENSTYLE_RGBS(axis==0?200:0,axis==1?200:0,axis==2?200:0,GENSTYLE_NONE);
+		int pos = ptr - turtle_commands_f9;
+		int axis = pos / 2;
+		style = GENSTYLE_RGBS(axis == 0 ? 200 : 0, axis == 1 ? 200 : 0, axis == 2 ? 200 : 0, GENSTYLE_NONE);
 	}
 	return style;
Index: cpp/frams/genetics/genman.cpp
===================================================================
--- cpp/frams/genetics/genman.cpp	(revision 167)
+++ cpp/frams/genetics/genman.cpp	(revision 168)
@@ -227,16 +227,16 @@
 Geno GenMan::Validate(const Geno& geny)
 {
-	char format=geny.getFormat();
-	GenoOperators *gf=getOper_f(format);
-	if (gf==NULL)
-		return Geno(SString::empty(),-1,SString::empty(),SString::sprintf("GENOPER_NOOPER: Validate(): don't know how to handle genetic format %c",format));
-	char *g2=strdup(geny.getGene()); //copy for validation
-	int res=gf->validate(g2);
-	SString sg2=g2;
+	char format = geny.getFormat();
+	GenoOperators *gf = getOper_f(format);
+	if (gf == NULL)
+		return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: Validate(): don't know how to handle genetic format %c", format));
+	char *g2 = strdup(geny.getGene()); //copy for validation
+	int res = gf->validate(g2);
+	SString sg2 = g2;
 	free(g2);
-	if (res==GENOPER_OK)
-		return Geno(sg2,format,geny.getName(),geny.getComment());
+	if (res == GENOPER_OK)
+		return Geno(sg2, format, geny.getName(), geny.getComment());
 	else
-		return Geno(SString::empty(),-1,SString::empty(),SString::sprintf("GENOPER_NOOPER: validate() for format %c returned invalid value",format));
+		return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: validate() for format %c returned invalid value", format));
 }
 
@@ -245,41 +245,45 @@
 	float chg; //how many changes
 	int method; //mutation method
-	char format=g.getFormat();
-	GenoOperators *gf=getOper_f(format);
-	if (gf==NULL)
-		return Geno(SString::empty(),-1,SString::empty(),SString::sprintf("GENOPER_NOOPER: Mutate(): don't know how to handle genetic format %c",format));
-	Geno gv=g;
-	bool canvalidate=true;
-	if (testValidity(gv,canvalidate)>0 && canvalidate==false)
-		return Geno("",-1,"","GENOPER_OPFAIL: Mutate(): cannot validate invalid source genotype");
-	bool ok=false;
-	int pcount=count;
+	char format = g.getFormat();
+	GenoOperators *gf = getOper_f(format);
+	if (gf == NULL)
+		return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: Mutate(): don't know how to handle genetic format %c", format));
+	Geno gv = g;
+	bool canvalidate = true;
+	if (testValidity(gv, canvalidate) > 0 && canvalidate == false)
+		return Geno("", -1, "", "GENOPER_OPFAIL: Mutate(): cannot validate invalid source genotype");
+	bool ok = false;
+	int pcount = count;
 	while (!ok)
 	{
-		char *gn=strdup(gv.getGene()); //copy for mutation
-		chg=0;
-		if (gf->mutate(gn,chg,method)==GENOPER_OK)
+		char *gn = strdup(gv.getGene()); //copy for mutation
+		chg = 0;
+		if (gf->mutate(gn, chg, method) == GENOPER_OK)
 		{
 			ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()
-			Geno G(gn,gv.getFormat(),"","");
-			canvalidate=true;
-			int res=testValidity(G,canvalidate);
-			if (res==GENOPER_OK && canvalidate==false) {valid_m++; ok=true;} else
-				if (res>0 && canvalidate==false) invalid_m++; else
-				{validated_m++; ok=true;}
-				if (ok) gv=G;
-		} else failed_m++;
+			Geno G(gn, gv.getFormat(), "", "");
+			canvalidate = true;
+			int res = testValidity(G, canvalidate);
+			if (res == GENOPER_OK && canvalidate == false) { valid_m++; ok = true; }
+			else
+				if (res > 0 && canvalidate == false) invalid_m++; else
+				{
+					validated_m++; ok = true;
+				}
+			if (ok) gv = G;
+		}
+		else failed_m++;
 		free(gn);
 		count++;
-		if (!ok && (count-pcount>100))
-		{
-			FMprintf("GenMan","Mutate",2,"Tried 100x and failed: %s",(const char*)g.getGene());
-			return Geno("",-1,"","GENOPER_OPFAIL: Mutate() tried 100x and failed");
-		}
-	}
-	mutchg+=chg;
-	if (history) saveLink((const char*)g.getGene(),(const char*)gv.getGene(),chg);
+		if (!ok && (count - pcount > 100))
+		{
+			FMprintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", (const char*)g.getGene());
+			return Geno("", -1, "", "GENOPER_OPFAIL: Mutate() tried 100x and failed");
+		}
+	}
+	mutchg += chg;
+	if (history) saveLink((const char*)g.getGene(), (const char*)gv.getGene(), chg);
 	SString mutinfo;
-	if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'",100*chg,(const char*)g.getName()); else
+	if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'", 100 * chg, (const char*)g.getName()); else
 		if (extmutinfo == 1) mutinfo = SString::sprintf("%.2f%% mutation(%d) of '%s'", 100 * chg, method, (const char*)g.getName()); else
 			mutinfo = SString::sprintf("%.2f%% mutation(%s) of '%s'", 100 * chg, gf->mutation_method_names ? gf->mutation_method_names[method] : "unspecified method name", (const char*)g.getName());
@@ -320,5 +324,5 @@
 		{
 			char *gn;
-			if (g1n[0] && g2n[0]) if (randomN(2) == 0) g1n[0] = 0; else g2n[0] = 0; //we want only one
+			if (g1n[0] && g2n[0]) if (randomN(2) == 0) g1n[0] = 0; else g2n[0] = 0; //both provided? we want only one
 			if (g1n[0]) { gn = g1n; chg = chg1; }
 			else { gn = g2n; chg = chg2; }
@@ -474,8 +478,8 @@
 	int ind = operformats.find(format);
 	if (ind == -1) return NULL;
-	int ktoryopformatu = seloper[ind];
+	int which_oper_of_format = seloper[ind];
 	for (unsigned int i = 0; i < oper_fx_list.size(); i++)
 		if (oper_fx_list[i]->supported_format == format)
-			if (ktoryopformatu == 0) return oper_fx_list[i]; else ktoryopformatu--;
+			if (which_oper_of_format == 0) return oper_fx_list[i]; else which_oper_of_format--;
 	return NULL; //should never happen
 }
Index: cpp/frams/genetics/oper_fx.cpp
===================================================================
--- cpp/frams/genetics/oper_fx.cpp	(revision 167)
+++ cpp/frams/genetics/oper_fx.cpp	(revision 168)
@@ -9,129 +9,129 @@
 #include <frams/util/rndutil.h>
 
-static double distrib_force[]=   // for '!'
-{
-3,                 // distribution 0 -__/ +1
-0.001, 0.2,        // "slow" neurons
-0.001, 1,
-    1, 1,          // "fast" neurons
+static double distrib_force[] =   // for '!'
+{
+	3,             // distribution 0 -__/ +1
+	0.001, 0.2,    // "slow" neurons
+	0.001, 1,
+	1, 1,          // "fast" neurons
 };
-static double distrib_inertia[]=  // for '='
-{
-2,                 // distribution 0 |..- +1
-  0, 0,            // "fast" neurons
-0.7, 0.98,
+static double distrib_inertia[] =  // for '='
+{
+	2,             // distribution 0 |..- +1
+	0, 0,          // "fast" neurons
+	0.7, 0.98,
 };
-static double distrib_sigmo[]=  // for '/'
-{
-5,                 // distribution -999 -..-^-..- +999
--999, -999,        //"perceptron"
- 999, 999,
-  -5, -1,          // nonlinear
-   1, 5,
-  -1, 1,           // ~linear
+static double distrib_sigmo[] =  // for '/'
+{
+	5,             // distribution -999 -..-^-..- +999
+	-999, -999,    //"perceptron"
+	999, 999,
+	-5, -1,        // nonlinear
+	1, 5,
+	-1, 1,         // ~linear
 };
 
 
-int GenoOperators::roulette(const double *probtab,const int count)
-{
-   double sum=0;
-   int i;
-   for (i=0;i<count;i++) sum+=probtab[i];
-   double sel=rnd01*sum;
-   for (sum=0,i=0;i<count;i++) {sum+=probtab[i]; if (sel<sum) return i;}
-   return -1;
-}
-
-bool GenoOperators::getMinMaxDef(ParamInterface *p,int i,double &mn,double &mx,double &def)
-{
-   mn=mx=def=0;
-   int defined=0;
-   if (p->type(i)[0]=='f')
-   {
-      double _mn=0,_mx=1,_def=0.5;
-      defined=p->getMinMax(i,_mn,_mx,_def);
-      if (defined==1) _mx=_mn+1.0;
-      if (_mx<_mn && defined==3) _mn=_mx=_def; //only default was defined, let's assume min=max=default
-      if (defined<3) _def=(_mn+_mx)/2.0;
-      mn=_mn; mx=_mx; def=_def;
-   }
-   if (p->type(i)[0]=='d')
-   {
-      long _mn=0,_mx=1,_def=0;
-      defined=p->getMinMax(i,_mn,_mx,_def);
-      if (defined==1) _mx=_mn+1;
-      if (_mx<_mn && defined==3) _mn=_mx=_def; //only default was defined, let's assume min=max=default
-      if (defined<3) _def=(_mn+_mx)/2;
-      mn=_mn; mx=_mx; def=_def;
-   }
-   return defined==3;
+int GenoOperators::roulette(const double *probtab, const int count)
+{
+	double sum = 0;
+	int i;
+	for (i = 0; i < count; i++) sum += probtab[i];
+	double sel = rnd01*sum;
+	for (sum = 0, i = 0; i < count; i++) { sum += probtab[i]; if (sel < sum) return i; }
+	return -1;
+}
+
+bool GenoOperators::getMinMaxDef(ParamInterface *p, int i, double &mn, double &mx, double &def)
+{
+	mn = mx = def = 0;
+	int defined = 0;
+	if (p->type(i)[0] == 'f')
+	{
+		double _mn = 0, _mx = 1, _def = 0.5;
+		defined = p->getMinMax(i, _mn, _mx, _def);
+		if (defined == 1) _mx = _mn + 1.0;
+		if (_mx < _mn && defined == 3) _mn = _mx = _def; //only default was defined, let's assume min=max=default
+		if (defined < 3) _def = (_mn + _mx) / 2.0;
+		mn = _mn; mx = _mx; def = _def;
+	}
+	if (p->type(i)[0] == 'd')
+	{
+		long _mn = 0, _mx = 1, _def = 0;
+		defined = p->getMinMax(i, _mn, _mx, _def);
+		if (defined == 1) _mx = _mn + 1;
+		if (_mx < _mn && defined == 3) _mn = _mx = _def; //only default was defined, let's assume min=max=default
+		if (defined < 3) _def = (_mn + _mx) / 2;
+		mn = _mn; mx = _mx; def = _def;
+	}
+	return defined == 3;
 }
 
 int GenoOperators::selectRandomProperty(Neuro* n)
 {
-   int neuext=n->extraProperties().getPropCount(),
-       neucls=n->getClass()==NULL?0:n->getClass()->getProperties().getPropCount();
-   if (neuext+neucls==0) return -1; //no properties in this neuron
-   int index=randomN(neuext+neucls);
-   if (index>=neuext) index=index-neuext+100;
-   return index;
-}
-
-double GenoOperators::mutateNeuProperty(double current,Neuro *n,int i)
-{
-   if (i==-1) return mutateCreepNoLimit('f',current,-10,10); //i==-1: mutating weight of neural connection
-   Param p;
-   if (i>=100) {i-=100; p=n->getClass()->getProperties();}
-      else p=n->extraProperties();
-   double newval=current;
-   /*bool ok=*/getMutatedProperty(p,i,current,newval);
-   return newval;
-}
-
-bool GenoOperators::mutatePropertyNaive(ParamInterface &p,int i)
-{
-   double mn,mx,df;
-   if (p.type(i)[0]!='f' && p.type(i)[0]!='d') return false; //don't know how to mutate
-   getMinMaxDef(&p,i,mn,mx,df);
-
-   ExtValue ev;
-   p.get(i,ev);
-   ev.setDouble(mutateCreep(p.type(i)[0],ev.getDouble(),mn,mx));
-   p.set(i,ev);
-   return true;
-}
-
-bool GenoOperators::mutateProperty(ParamInterface &p,int i)
-{
-   double newval;
-   ExtValue ev;
-   p.get(i,ev);
-   bool ok=getMutatedProperty(p,i,ev.getDouble(),newval);
-   if (ok) {ev.setDouble(newval); p.set(i,ev);}
-   return ok;
-}
-
-bool GenoOperators::getMutatedProperty(ParamInterface &p,int i,double oldval,double &newval)
-{
-   newval=0;
-   if (p.type(i)[0]!='f' && p.type(i)[0]!='d') return false; //don't know how to mutate
-   const char *n=p.id(i),*na=p.name(i);
-     if (strcmp(n,"si")==0 && strcmp(na,"Sigmoid")==0) newval=CustomRnd(distrib_sigmo); else
-     if (strcmp(n,"in")==0 && strcmp(na,"Inertia")==0) newval=CustomRnd(distrib_inertia); else
-     if (strcmp(n,"fo")==0 && strcmp(na,"Force")==0) newval=CustomRnd(distrib_force); else
-     {
-       double mn,mx,df;
-       getMinMaxDef(&p,i,mn,mx,df);
-       newval=mutateCreep(p.type(i)[0],oldval,mn,mx);
-     }
-   return true;
-}
-
-double GenoOperators::mutateCreepNoLimit(char type,double current,double mn,double mx)
-{
-   double result=RndGen.Gauss(current,(mx-mn)/2/5); // /halfinterval, 5 times narrower
-   if (type=='d') {result=int(result+0.5); if (result==current) result+=randomN(2)*2-1;}
-    else result=floor(result*1000+0.5)/1000.0; //round
-   return result;
+	int neuext = n->extraProperties().getPropCount(),
+		neucls = n->getClass() == NULL ? 0 : n->getClass()->getProperties().getPropCount();
+	if (neuext + neucls == 0) return -1; //no properties in this neuron
+	int index = randomN(neuext + neucls);
+	if (index >= neuext) index = index - neuext + 100;
+	return index;
+}
+
+double GenoOperators::mutateNeuProperty(double current, Neuro *n, int i)
+{
+	if (i == -1) return mutateCreepNoLimit('f', current, -10, 10); //i==-1: mutating weight of neural connection
+	Param p;
+	if (i >= 100) { i -= 100; p = n->getClass()->getProperties(); }
+	else p = n->extraProperties();
+	double newval = current;
+	/*bool ok=*/getMutatedProperty(p, i, current, newval);
+	return newval;
+}
+
+bool GenoOperators::mutatePropertyNaive(ParamInterface &p, int i)
+{
+	double mn, mx, df;
+	if (p.type(i)[0] != 'f' && p.type(i)[0] != 'd') return false; //don't know how to mutate
+	getMinMaxDef(&p, i, mn, mx, df);
+
+	ExtValue ev;
+	p.get(i, ev);
+	ev.setDouble(mutateCreep(p.type(i)[0], ev.getDouble(), mn, mx));
+	p.set(i, ev);
+	return true;
+}
+
+bool GenoOperators::mutateProperty(ParamInterface &p, int i)
+{
+	double newval;
+	ExtValue ev;
+	p.get(i, ev);
+	bool ok = getMutatedProperty(p, i, ev.getDouble(), newval);
+	if (ok) { ev.setDouble(newval); p.set(i, ev); }
+	return ok;
+}
+
+bool GenoOperators::getMutatedProperty(ParamInterface &p, int i, double oldval, double &newval)
+{
+	newval = 0;
+	if (p.type(i)[0] != 'f' && p.type(i)[0] != 'd') return false; //don't know how to mutate
+	const char *n = p.id(i), *na = p.name(i);
+	if (strcmp(n, "si") == 0 && strcmp(na, "Sigmoid") == 0) newval = CustomRnd(distrib_sigmo); else
+		if (strcmp(n, "in") == 0 && strcmp(na, "Inertia") == 0) newval = CustomRnd(distrib_inertia); else
+			if (strcmp(n, "fo") == 0 && strcmp(na, "Force") == 0) newval = CustomRnd(distrib_force); else
+			{
+				double mn, mx, df;
+				getMinMaxDef(&p, i, mn, mx, df);
+				newval = mutateCreep(p.type(i)[0], oldval, mn, mx);
+			}
+	return true;
+}
+
+double GenoOperators::mutateCreepNoLimit(char type, double current, double mn, double mx)
+{
+	double result = RndGen.Gauss(current, (mx - mn) / 2 / 5); // /halfinterval, 5 times narrower
+	if (type == 'd') { result = int(result + 0.5); if (result == current) result += randomN(2) * 2 - 1; }
+	else result = floor(result * 1000 + 0.5) / 1000.0; //round
+	return result;
 }
 
@@ -180,72 +180,74 @@
 {
 	SListTempl<NeuroClass*> active;
-   for(int i=0;i<Neuro::getClassCount();i++)
-      if (Neuro::getClass(i)->genactive) active+=Neuro::getClass(i);
-   if (!active==0) return NULL; else return active(randomN(!active));
+	for (int i = 0; i < Neuro::getClassCount(); i++)
+		if (Neuro::getClass(i)->genactive) active += Neuro::getClass(i);
+	if (!active == 0) return NULL; else return active(randomN(!active));
 }
 
 NeuroClass* GenoOperators::parseNeuroClass(char*& s)
 {
-   int len=strlen(s);
-   int Len=0;
-   NeuroClass *I=NULL;
-   for(int i=0;i<Neuro::getClassCount();i++)
-   {
-      const char *n=Neuro::getClass(i)->name;
-      int l=strlen(n);
-      if (len>=l && l>Len && (strncmp(s,n,l)==0)) {I=Neuro::getClass(i); Len=l;}
-   }
-   s+=Len;
-   return I;
-}
-
-Neuro* GenoOperators::findNeuro(const Model *m,const NeuroClass *nc)
-{
-  if (!m) return NULL;
-  for(int i=0;i<m->getNeuroCount();i++)
-     if (m->getNeuro(i)->getClass()==nc) return m->getNeuro(i);
-  return NULL; //neuron of class 'nc' was not found
-}
-
-int GenoOperators::neuroClassProp(char*& s,NeuroClass *nc,bool also_v1_N_props)
-{
-   int len=strlen(s);
-   int Len=0,I=-1;
-   if (nc)
-   {
-      Param p=nc->getProperties();
-      for(int i=0;i<p.getPropCount();i++)
-      {
-         const char *n=p.id(i);
-         int l=strlen(n);
-         if (len>=l && l>Len && (strncmp(s,n,l)==0)) {I=100+i; Len=l;}
-         if (also_v1_N_props) //recognize old properties symbols /=!
-         {
-            if (strcmp(n,"si")==0) n="/"; else
-            if (strcmp(n,"in")==0) n="="; else
-            if (strcmp(n,"fo")==0) n="!";
-            l=strlen(n);
-            if (len>=l && l>Len && (strncmp(s,n,l)==0)) {I=100+i; Len=l;}
-         }
-      }
-   }
-   Neuro n;
-   Param p=n.extraProperties();
-   for(int i=0;i<p.getPropCount();i++)
-   {
-      const char *n=p.id(i);
-      int l=strlen(n);
-      if (len>=l && l>Len && (strncmp(s,n,l)==0)) {I=i; Len=l;}
-   }
-   s+=Len;
-   return I;
+	int len = strlen(s);
+	int Len = 0;
+	NeuroClass *I = NULL;
+	for (int i = 0; i<Neuro::getClassCount(); i++)
+	{
+		const char *n = Neuro::getClass(i)->name;
+		int l = strlen(n);
+		if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = Neuro::getClass(i); Len = l; }
+	}
+	s += Len;
+	return I;
+}
+
+Neuro* GenoOperators::findNeuro(const Model *m, const NeuroClass *nc)
+{
+	if (!m) return NULL;
+	for (int i = 0; i < m->getNeuroCount(); i++)
+		if (m->getNeuro(i)->getClass() == nc) return m->getNeuro(i);
+	return NULL; //neuron of class 'nc' was not found
+}
+
+int GenoOperators::neuroClassProp(char*& s, NeuroClass *nc, bool also_v1_N_props)
+{
+	int len = strlen(s);
+	int Len = 0, I = -1;
+	if (nc)
+	{
+		Param p = nc->getProperties();
+		for (int i = 0; i<p.getPropCount(); i++)
+		{
+			const char *n = p.id(i);
+			int l = strlen(n);
+			if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = 100 + i; Len = l; }
+			if (also_v1_N_props) //recognize old properties symbols /=!
+			{
+				if (strcmp(n, "si") == 0) n = "/"; else
+					if (strcmp(n, "in") == 0) n = "="; else
+						if (strcmp(n, "fo") == 0) n = "!";
+				l = strlen(n);
+				if (len >= l && l > Len && (strncmp(s, n, l) == 0)) { I = 100 + i; Len = l; }
+			}
+		}
+	}
+	Neuro n;
+	Param p = n.extraProperties();
+	for (int i = 0; i<p.getPropCount(); i++)
+	{
+		const char *n = p.id(i);
+		int l = strlen(n);
+		if (len >= l && l>Len && (strncmp(s, n, l) == 0)) { I = i; Len = l; }
+	}
+	s += Len;
+	return I;
 }
 
 bool GenoOperators::isWS(const char c)
-{return c==' ' || c=='\n' || c=='\t' || c=='\r';}
+{
+	return c == ' ' || c == '\n' || c == '\t' || c == '\r';
+}
 
 void GenoOperators::skipWS(char *&s)
 {
-	if (s==NULL)
+	if (s == NULL)
 		FramMessage("GenoOperators", "skipWS", "NULL reference!", FMLV_WARN);
 	else
@@ -253,5 +255,5 @@
 }
 
-bool GenoOperators::areAlike(char *g1,char *g2)
+bool GenoOperators::areAlike(char *g1, char *g2)
 {
 	while (*g1 || *g2)
@@ -260,17 +262,19 @@
 		skipWS(g2);
 		if (*g1 != *g2) return false; //when difference
-      if (!*g1 && !*g2) break; //both end
-      g1++;
-      g2++;
+		if (!*g1 && !*g2) break; //both end
+		g1++;
+		g2++;
 	}
 	return true; //equal
 }
 
-char* GenoOperators::strchrn0(const char *str,char ch)
-{ return ch==0?NULL:strchr((char*)str,ch); }
+char* GenoOperators::strchrn0(const char *str, char ch)
+{
+	return ch == 0 ? NULL : strchr((char*)str, ch);
+}
 
 bool GenoOperators::isNeuroClassName(const char firstchar)
 {
-   return isupper(firstchar) || firstchar=='|' || firstchar=='@' || firstchar=='*';
-}
-
+	return isupper(firstchar) || firstchar == '|' || firstchar == '@' || firstchar == '*';
+}
+
