Index: cpp/frams/genetics/f9/conv_f9.cpp
===================================================================
--- cpp/frams/genetics/f9/conv_f9.cpp	(revision 247)
+++ cpp/frams/genetics/f9/conv_f9.cpp	(revision 259)
@@ -8,5 +8,5 @@
 #include <common/nonstd_stl.h> //ARRAY_LENGTH
 
-#define APPLY_DETERMINISTIC_BODY_NOISE //this representation easily produces perfectly vertical sticks that would stay upright forever. In most cases such infinite perfection is not desired, so we make the construct less perfect by perturbing its coordinates.
+#define APPLY_DETERMINISTIC_BODY_NOISE //this genetic representation easily produces perfectly vertical sticks that would stay upright forever in simulation. In most cases such infinite perfection is not desired, so we make the construct less perfect by perturbing its coordinates.
 
 GenoConv_f90::GenoConv_f90()
@@ -15,5 +15,5 @@
 	in_format = '9';
 	out_format = '0';
-	mapsupport = 0; //would be easy and nice to add!
+	mapsupport = 1;
 }
 
@@ -31,5 +31,5 @@
 	Model m;
 	m.open();
-	int recently_added = addSegment(m, vertices, current, 0xDead);
+	int recently_added = addSegment(m, 0, vertices, current, 0xDead);
 	for (int i = 0; i < in.len(); i++)
 	{
@@ -44,5 +44,5 @@
 			(*(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, i, vertices, current, recently_added);
 		}
 	}
@@ -54,8 +54,10 @@
 	if (m.getPartCount() < 2) //only one part <=> there were no valid turtle commands in the input genotype
 		return ""; //so we return an invalid f0 genotype
+	if (map != NULL)
+		m.getCurrentToF0Map(*map);
 	return m.getF0Geno().getGene();
 }
 
-int GenoConv_f90::addSegment(Model &m, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex, int recently_added)
+int GenoConv_f90::addSegment(Model &m, int genenr, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex, int recently_added)
 {
 	if (vertices.size() < 1) //empty model?
@@ -72,8 +74,15 @@
 		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);
-		}
+		p1->addMapping(MultiRange(genenr, genenr));
+		p2->addMapping(MultiRange(genenr, genenr));
+
+		int j12 = m.findJoint(p1, p2);
+		int j21 = m.findJoint(p2, p1);
+		if (j12 >= 0)
+			m.getJoint(j12)->addMapping(MultiRange(genenr, genenr));
+		else if (j21 >= 0)
+			m.getJoint(j21)->addMapping(MultiRange(genenr, genenr));
+		else //both j12<0 and j21<0. New Joint needed. Should always happen if we just created a new Part (vertex_here was <0)
+			m.addNewJoint(p1, p2)->addMapping(MultiRange(genenr, genenr));
 		return vertex_here;
 	}
@@ -134,5 +143,5 @@
 	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);
Index: cpp/frams/genetics/f9/conv_f9.h
===================================================================
--- cpp/frams/genetics/f9/conv_f9.h	(revision 247)
+++ cpp/frams/genetics/f9/conv_f9.h	(revision 259)
@@ -21,13 +21,13 @@
 struct XYZ_LOC
 {
-	int x,y,z; //coordinates xyz of a vertex - represented as int's so that it is easy and safe to check identity. Could also be done using lists of Model's Parts, but that would involve comparing floats
-	XYZ_LOC() {x=y=z=0;}
-	void add(int delta[3]) {x+=delta[0]; y+=delta[1]; z+=delta[2];}
-	bool same_coordinates(const XYZ_LOC &loc) {return x==loc.x && y==loc.y && z==loc.z;}
+	int x, y, z; //coordinates xyz of a vertex - represented as int's so that it is easy and safe to check identity. Could also be done using lists of Model's Parts, but that would involve comparing floats
+	XYZ_LOC() { x = y = z = 0; }
+	void add(int delta[3]) { x += delta[0]; y += delta[1]; z += delta[2]; }
+	bool same_coordinates(const XYZ_LOC &loc) { return x == loc.x && y == loc.y && z == loc.z; }
 };
 
 
 // The f9->f0 converter
-class GenoConv_f90: public GenoConverter
+class GenoConv_f90 : public GenoConverter
 {
 public:
@@ -39,7 +39,7 @@
 protected:
 	//auxiliary methods
-	int addSegment(Model &m,vector<XYZ_LOC> &vertices,const XYZ_LOC &new_vertex,int recently_added);
-	int findVertexAt(vector<XYZ_LOC> &vertices,const XYZ_LOC &new_vertex);
-	int addNewVertex(Model &m,vector<XYZ_LOC> &punkty,const XYZ_LOC &nowypunkt);
+	int addSegment(Model &m, int genenr, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex, int recently_added);
+	int findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex);
+	int addNewVertex(Model &m, vector<XYZ_LOC> &punkty, const XYZ_LOC &nowypunkt);
 	void setColors(Model &m); //sets fixed (independent from genes) colors and widths on a model, purely for aesthetic purposes
 	void perturbPartLocations(Model &m); //deterministic "body noise", see APPLY_DETERMINISTIC_BODY_NOISE
