Index: cpp/f8-to-f1/conv_f8tof1.cpp
===================================================================
--- cpp/f8-to-f1/conv_f8tof1.cpp	(revision 6)
+++ cpp/f8-to-f1/conv_f8tof1.cpp	(revision 7)
@@ -601,6 +601,6 @@
 		int position = firstProduction->parameters.getParameterPosition(stringToSString(iter->first));
 		//cout << "position of " << iter->first << ": " << position << endl;
-		//params.insert(params.begin() + (position - 1), iter->second);
-		params[position - 1] = iter->second;
+		params.insert(params.begin() + (position - 1), iter->second);
+		//params[position - 1] = iter->second;
 	}
 	
@@ -646,4 +646,7 @@
 		if (a != NULL) {
 			dst += a->getF1Genotype(p);
+			if (dst.len() > 1500) {
+				return ""; //genotype becomes too long so we abort conversion
+			}
 		}
 	}
Index: cpp/f8-to-f1/conv_f8tof1_grammar.c
===================================================================
--- cpp/f8-to-f1/conv_f8tof1_grammar.c	(revision 6)
+++ cpp/f8-to-f1/conv_f8tof1_grammar.c	(revision 7)
@@ -135,67 +135,67 @@
 */
 static const YYACTIONTYPE yy_action[] = {
- /*     0 */    40,    4,   23,   24,   25,   26,   27,   28,   64,   67,
- /*    10 */    31,   71,   44,   55,    4,   41,   34,   82,   75,   64,
- /*    20 */    65,   68,   70,   31,   65,   44,   84,    4,   41,   34,
- /*    30 */    82,   75,   64,   65,   68,   70,   69,   65,   44,   20,
- /*    40 */    60,    4,   61,   56,    4,   47,    8,   68,   70,   46,
- /*    50 */    69,   32,   44,   69,   49,   44,   59,   57,    4,   47,
- /*    60 */    42,   68,   70,   85,   68,   70,   38,   69,   76,   44,
- /*    70 */    10,   45,   39,   77,   58,   15,   14,    5,   68,   70,
- /*    80 */    65,   71,   72,   73,   12,   13,   15,   14,   60,    9,
- /*    90 */    61,   91,   78,    6,   60,   48,   61,   53,    1,   33,
- /*   100 */    35,   10,   45,   39,   79,   33,   66,   80,   12,   13,
- /*   110 */    15,   14,  139,   16,   60,   60,   61,   61,   52,   60,
- /*   120 */    60,   61,   61,   81,   17,   36,   37,   54,   22,   51,
- /*   130 */    62,   63,   30,   18,   50,    3,    2,   43,   74,   11,
- /*   140 */    75,   88,    7,   19,   21,   83,   18,   50,   86,   29,
- /*   150 */    87,   89,   90,
+ /*     0 */    46,    4,   23,   24,   26,   27,   22,   28,   85,   61,
+ /*    10 */    31,   62,   43,   56,    4,   40,   37,   83,   76,   66,
+ /*    20 */    63,   69,   71,   31,   72,   43,    9,    4,   40,   37,
+ /*    30 */    83,   76,   47,    4,   69,   71,   70,   14,   43,  139,
+ /*    40 */    17,    4,   70,   59,   43,   51,   66,   69,   71,   57,
+ /*    50 */    70,   52,   43,   69,   71,   38,    4,   58,   15,   11,
+ /*    60 */    84,   69,   71,   19,   61,   70,   62,   43,   12,   13,
+ /*    70 */    15,   11,   44,   89,   30,   34,   69,   71,   16,   48,
+ /*    80 */    75,    5,   76,   91,   66,   72,   73,   74,   12,   13,
+ /*    90 */    15,   11,   61,   20,   62,   65,   66,    6,    1,    2,
+ /*   100 */    65,    7,   42,   33,   35,   54,   10,   39,   41,   10,
+ /*   110 */    39,   41,   61,   49,   62,   68,   61,   61,   62,   62,
+ /*   120 */    61,   88,   62,   33,   67,   65,   66,   36,   32,   25,
+ /*   130 */     8,   64,   52,   18,   16,   48,   86,   55,   29,   53,
+ /*   140 */    60,   87,   90,   81,    3,   77,   78,   45,   21,   79,
+ /*   150 */   140,  140,   80,   82,   50,
 };
 static const YYCODETYPE yy_lookahead[] = {
- /*     0 */    27,   28,   13,   14,   15,   16,   17,   18,   21,   11,
- /*    10 */    37,   23,   39,   27,   28,   42,   43,   44,   45,   21,
- /*    20 */    22,   48,   49,   37,   22,   39,   11,   28,   42,   43,
- /*    30 */    44,   45,   21,   22,   48,   49,   37,   22,   39,   32,
- /*    40 */    35,   28,   37,   44,   28,   37,    1,   48,   49,   41,
- /*    50 */    37,   46,   39,   37,    7,   39,   11,   44,   28,   37,
- /*    60 */    44,   48,   49,   41,   48,   49,   34,   37,   35,   39,
- /*    70 */    38,   39,   40,   35,   44,    4,    5,   19,   48,   49,
- /*    80 */    22,   23,   24,   25,    2,    3,    4,    5,   35,   33,
- /*    90 */    37,    0,   35,   11,   35,   39,   37,   34,    9,   46,
- /*   100 */    47,   38,   39,   40,   35,   46,   47,   35,    2,    3,
- /*   110 */     4,    5,   29,   30,   35,   35,   37,   37,   35,   35,
- /*   120 */    35,   37,   37,   35,    1,   46,   46,    6,   31,   35,
- /*   130 */    46,   46,   37,   36,   37,   12,    9,   20,   43,   10,
- /*   140 */    45,   31,   10,   10,    1,   11,   36,   37,    6,    8,
- /*   150 */     6,    6,    6,
+ /*     0 */    27,   28,   13,   14,   15,   16,   17,   18,   11,   35,
+ /*    10 */    37,   37,   39,   27,   28,   42,   43,   44,   45,   22,
+ /*    20 */    46,   48,   49,   37,   23,   39,   33,   28,   42,   43,
+ /*    30 */    44,   45,   39,   28,   48,   49,   37,   10,   39,   29,
+ /*    40 */    30,   28,   37,   44,   39,   35,   22,   48,   49,   44,
+ /*    50 */    37,   37,   39,   48,   49,   41,   28,   44,    4,    5,
+ /*    60 */    11,   48,   49,   10,   35,   37,   37,   39,    2,    3,
+ /*    70 */     4,    5,   44,   31,   37,   46,   48,   49,   36,   37,
+ /*    80 */    43,   19,   45,    0,   22,   23,   24,   25,    2,    3,
+ /*    90 */     4,    5,   35,    1,   37,   21,   22,   11,    9,    9,
+ /*   100 */    21,   10,   34,   46,   47,   34,   38,   39,   40,   38,
+ /*   110 */    39,   40,   35,   20,   37,   11,   35,   35,   37,   37,
+ /*   120 */    35,    6,   37,   46,   47,   21,   22,   46,   46,   31,
+ /*   130 */     1,   46,   37,    1,   36,   37,   41,    6,    8,    6,
+ /*   140 */    11,    6,    6,   35,   12,   35,   35,    7,   32,   35,
+ /*   150 */    50,   50,   35,   35,   35,
 };
-#define YY_SHIFT_USE_DFLT (-14)
+#define YY_SHIFT_USE_DFLT (-12)
 #define YY_SHIFT_MAX 52
 static const short yy_shift_ofst[] = {
- /*     0 */   -13,   58,   58,   58,   58,   58,   58,   -2,   11,  -12,
- /*    10 */   -12,   11,   11,   11,   11,   11,    2,    2,    2,   15,
- /*    20 */   -12,    2,   47,  -13,  -13,  -13,  -13,  -13,  -13,  -13,
- /*    30 */   -11,  -11,   82,  106,  123,   45,   71,   71,   91,   89,
- /*    40 */   121,  127,  117,  129,  132,  133,  134,  143,  142,  144,
- /*    50 */   141,  145,  146,
+ /*     0 */    79,   62,   62,   62,   62,   62,   62,  104,   74,    1,
+ /*    10 */     1,   74,   74,   74,   74,   74,   24,   24,   24,   -3,
+ /*    20 */    24,    1,   79,   79,   79,  140,   79,   79,   79,   79,
+ /*    30 */   -11,  -11,   86,   66,   54,  129,   54,  132,   49,   53,
+ /*    40 */    89,   90,   83,   91,   93,  115,  131,  135,  130,   27,
+ /*    50 */   136,  133,   92,
 };
 #define YY_REDUCE_USE_DFLT (-28)
 #define YY_REDUCE_MAX 29
 static const signed char yy_reduce_ofst[] = {
- /*     0 */    83,  -27,  -14,   -1,   13,   16,   30,   53,   59,   32,
- /*    10 */    63,    5,   79,   80,   84,   85,   97,   95,  110,    8,
- /*    20 */    56,   22,    7,   33,   38,   57,   69,   72,   88,   94,
+ /*     0 */    10,  -14,  -27,    5,   13,   28,   -1,   57,   77,   68,
+ /*    10 */    71,  -26,   29,   81,   82,   85,   42,   98,   37,   14,
+ /*    20 */    95,   -7,  108,  110,  111,  116,  114,  117,  118,  119,
 };
 static const YYACTIONTYPE yy_default[] = {
  /*     0 */   138,  117,  117,  117,  117,  117,  117,  138,  138,   98,
- /*    10 */    98,  138,  138,  138,  138,  138,   95,  138,   95,  138,
+ /*    10 */    98,  138,  138,  138,  138,  138,   95,   95,  138,  138,
  /*    20 */   138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
- /*    30 */   138,  123,  138,  125,  138,  138,  129,  130,  138,  138,
- /*    40 */   138,  106,  138,  138,  138,  138,  138,  104,  138,  138,
- /*    50 */   138,  138,  138,   97,  100,  105,  107,  118,  119,  120,
- /*    60 */   127,  128,  131,  132,  133,  134,  126,  121,  122,  123,
- /*    70 */   124,  135,  136,  137,  109,  110,  111,  112,  113,  114,
- /*    80 */   115,  116,  108,  101,  102,  103,   99,   93,   94,   96,
- /*    90 */    92,
+ /*    30 */   138,  123,  138,  125,  129,  138,  130,  138,  138,  138,
+ /*    40 */   106,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+ /*    50 */   138,  138,  104,   92,   97,  100,  105,  107,  118,  119,
+ /*    60 */   120,  127,  128,  131,  132,  133,  134,  126,  121,  122,
+ /*    70 */   123,  124,  135,  136,  137,  109,  110,  111,  112,  113,
+ /*    80 */   114,  115,  116,  108,  101,  102,  103,   99,   93,   94,
+ /*    90 */    96,
 };
 #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
@@ -1184,13 +1184,12 @@
 #endif
 		}
-		
 		delete yymsp[-1].minor.yy89.actions;
 		delete yymsp[-1].minor.yy89.parameters;
 	}
 }
-#line 1193 "conv_f8tof1_grammar.c"
+#line 1192 "conv_f8tof1_grammar.c"
         break;
       case 28: /* real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN real_prod */
-#line 394 "conv_f8tof1_grammar.y"
+#line 393 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1224,8 +1223,8 @@
 	}
 }
-#line 1228 "conv_f8tof1_grammar.c"
+#line 1227 "conv_f8tof1_grammar.c"
         break;
       case 29: /* prod_piece ::= prod_name LPAREN multiple_val RPAREN */
-#line 426 "conv_f8tof1_grammar.y"
+#line 425 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1245,8 +1244,8 @@
 	}
 }
-#line 1249 "conv_f8tof1_grammar.c"
+#line 1248 "conv_f8tof1_grammar.c"
         break;
       case 30: /* prod_piece ::= prod_name LPAREN RPAREN */
-#line 443 "conv_f8tof1_grammar.y"
+#line 442 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1257,5 +1256,7 @@
 		}
 		yygotominor.yy89.actions = new vector<Action*>();
+		vector<SString> param;
 		yygotominor.yy89.parameters = new vector<vector<SString> >();
+		yygotominor.yy89.parameters->push_back(param);
 		
 		Production *p = lsys->productions.find(sstringToString(*(yymsp[-2].minor.yy78.strValue)))->second;
@@ -1264,8 +1265,8 @@
 	}
 }
-#line 1268 "conv_f8tof1_grammar.c"
+#line 1269 "conv_f8tof1_grammar.c"
         break;
       case 31: /* prod_piece ::= command */
-#line 458 "conv_f8tof1_grammar.y"
+#line 459 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1284,8 +1285,8 @@
 	}
 }
-#line 1288 "conv_f8tof1_grammar.c"
+#line 1289 "conv_f8tof1_grammar.c"
         break;
       case 32: /* prod_piece ::= param_name */
-#line 474 "conv_f8tof1_grammar.y"
+#line 475 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1305,8 +1306,8 @@
 	}
 }
-#line 1309 "conv_f8tof1_grammar.c"
+#line 1310 "conv_f8tof1_grammar.c"
         break;
       case 33: /* prod_piece ::= neuron */
-#line 491 "conv_f8tof1_grammar.y"
+#line 492 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1326,8 +1327,8 @@
 	}
 }
-#line 1330 "conv_f8tof1_grammar.c"
+#line 1331 "conv_f8tof1_grammar.c"
         break;
       case 34: /* multiple_val ::= single_val */
-#line 509 "conv_f8tof1_grammar.y"
+#line 510 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1342,8 +1343,8 @@
 	}
 }
-#line 1346 "conv_f8tof1_grammar.c"
+#line 1347 "conv_f8tof1_grammar.c"
         break;
       case 35: /* multiple_val ::= multiple_val COMMA multiple_val */
-#line 521 "conv_f8tof1_grammar.y"
+#line 522 "conv_f8tof1_grammar.y"
 {
 	if (!syntaxOnly) {
@@ -1364,8 +1365,8 @@
 	}
 }
-#line 1368 "conv_f8tof1_grammar.c"
+#line 1369 "conv_f8tof1_grammar.c"
         break;
       case 36: /* single_val ::= double_val */
-#line 540 "conv_f8tof1_grammar.y"
+#line 541 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1379,8 +1380,8 @@
 	}
 }
-#line 1383 "conv_f8tof1_grammar.c"
+#line 1384 "conv_f8tof1_grammar.c"
         break;
       case 37: /* single_val ::= param_name */
-#line 551 "conv_f8tof1_grammar.y"
+#line 552 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1394,8 +1395,8 @@
 	}
 }
-#line 1398 "conv_f8tof1_grammar.c"
+#line 1399 "conv_f8tof1_grammar.c"
         break;
       case 38: /* single_val ::= single_val PLUS single_val */
-#line 562 "conv_f8tof1_grammar.y"
+#line 563 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1410,8 +1411,8 @@
 	}
 }
-#line 1414 "conv_f8tof1_grammar.c"
+#line 1415 "conv_f8tof1_grammar.c"
         break;
       case 39: /* single_val ::= single_val MINUS single_val */
-#line 574 "conv_f8tof1_grammar.y"
+#line 575 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1426,8 +1427,8 @@
 	}
 }
-#line 1430 "conv_f8tof1_grammar.c"
+#line 1431 "conv_f8tof1_grammar.c"
         break;
       case 40: /* single_val ::= single_val TIMES single_val */
-#line 586 "conv_f8tof1_grammar.y"
+#line 587 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1442,8 +1443,8 @@
 	}
 }
-#line 1446 "conv_f8tof1_grammar.c"
+#line 1447 "conv_f8tof1_grammar.c"
         break;
       case 41: /* single_val ::= single_val DIV single_val */
-#line 598 "conv_f8tof1_grammar.y"
+#line 599 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1458,8 +1459,8 @@
 	}
 }
-#line 1462 "conv_f8tof1_grammar.c"
+#line 1463 "conv_f8tof1_grammar.c"
         break;
       case 42: /* double_val ::= DOUBLE_VAL */
-#line 611 "conv_f8tof1_grammar.y"
+#line 612 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1472,8 +1473,8 @@
 	}
 }
-#line 1476 "conv_f8tof1_grammar.c"
+#line 1477 "conv_f8tof1_grammar.c"
         break;
       case 43: /* param_name ::= PARAM_NAME */
-#line 621 "conv_f8tof1_grammar.y"
+#line 622 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1486,8 +1487,8 @@
 	}
 }
-#line 1490 "conv_f8tof1_grammar.c"
+#line 1491 "conv_f8tof1_grammar.c"
         break;
       case 44: /* prod_name ::= PROD_NAME */
-#line 631 "conv_f8tof1_grammar.y"
+#line 632 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1500,8 +1501,8 @@
 	}
 }
-#line 1504 "conv_f8tof1_grammar.c"
+#line 1505 "conv_f8tof1_grammar.c"
         break;
       case 45: /* command ::= COMMAND */
-#line 641 "conv_f8tof1_grammar.y"
+#line 642 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1514,8 +1515,8 @@
 	}
 }
-#line 1518 "conv_f8tof1_grammar.c"
+#line 1519 "conv_f8tof1_grammar.c"
         break;
       case 46: /* neuron ::= NEURON */
-#line 651 "conv_f8tof1_grammar.y"
+#line 652 "conv_f8tof1_grammar.y"
 { 
 	if (!syntaxOnly) {
@@ -1528,5 +1529,5 @@
 	}
 }
-#line 1532 "conv_f8tof1_grammar.c"
+#line 1533 "conv_f8tof1_grammar.c"
         break;
   };
Index: cpp/f8-to-f1/geno_f8.cpp
===================================================================
--- cpp/f8-to-f1/geno_f8.cpp	(revision 6)
+++ cpp/f8-to-f1/geno_f8.cpp	(revision 7)
@@ -1199,43 +1199,21 @@
 
 RelationType Geno_f8::getDifferentCondition(RelationType type) {
-	RelationType types[5];
+	RelationType types[6];
+	types[0] = r_greater;
+	types[1] = r_greaterEqual;
+	types[2] = r_equal;
+	types[3] = r_different;
+	types[4] = r_lessEqual;
+	types[5] = r_less;
+	
+	for (int i = 0; i < 6; i++) {
+		if (types[i] == type) {
+			types[i] = types[5];
+			types[5] = type;
+			break;
+		}
+	}
+	
 	int randomType = randomN(5);
-	if (type == r_greater) {
-		types[0] = r_greaterEqual;
-		types[1] = r_equal;
-		types[2] = r_different;
-		types[3] = r_lessEqual;
-		types[4] = r_less;
-	} else if (type == r_greaterEqual) {
-		types[0] = r_greater;
-		types[1] = r_equal;
-		types[2] = r_different;
-		types[3] = r_lessEqual;
-		types[4] = r_less;
-	} else if (type == r_equal) {
-		types[0] = r_greater;
-		types[1] = r_greaterEqual;
-		types[2] = r_different;
-		types[3] = r_lessEqual;
-		types[4] = r_less;
-	} else if (type == r_different) {
-		types[0] = r_greater;
-		types[1] = r_greaterEqual;
-		types[2] = r_equal;
-		types[3] = r_lessEqual;
-		types[4] = r_less;
-	} else if (type == r_lessEqual) {
-		types[0] = r_greater;
-		types[1] = r_greaterEqual;
-		types[2] = r_equal;
-		types[3] = r_different;
-		types[4] = r_less;
-	} else if (type == r_less) {
-		types[0] = r_greater;
-		types[1] = r_greaterEqual;
-		types[2] = r_equal;
-		types[3] = r_different;
-		types[4] = r_lessEqual;
-	}
 	return types[randomType];
 }
