package eco.neural;
import java.util.Random;
public class GeneticMixer{

/**
 * @param parentOne the chromosome of the first parent
 * @param parentTwo the chromosome of the second parent
 * @return a new semirandom child chromosome


 */

public static Random random = new Random();

 public static void start(){
 int one = randInt(1,5);
 int two = randInt(1,5);
 int child = spawnChildChromosome(one, two);
 System.out.println("One: " + one);
 System.out.println("Two: " + two);
 System.out.println("Child: " + child);
 System.out.println("One: " + Integer.toBinaryString(one));
 System.out.println("Two: " + Integer.toBinaryString(two));
 System.out.println("Child: " + Integer.toBinaryString(child));
 }

 public static int randInt(int min, int max) { //Returns a random number between min and max.

 return min + random.nextInt((max + 1)- min);

 }

 public static int spawnChildChromosome(int parentOne, int parentTwo) {
 int base = parentOne & parentTwo;
 Random rand = new Random();
 int powers2[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
 int exponents[] = {1, 2, 4, 8, 16};
 int max = Math.max(parentOne, parentTwo);
 int result = 0;
 System.out.println(max);
 for (int m = 4; m >= 0; m--) {
 if ((max & powers2[m])!=0) {
 max >>= exponents[m];
 result |= exponents[m];
 }
 }
 result+=1;
 System.out.println(result);
 for (int n = 0; n < result; n ++){
 if (((parentOne^parentTwo)&n) == 0){
 base |= rand.nextInt(2)<<n; // 0001; 0010; 0100; 1000;
 }

 }
 return base;
 }










}

@@ -13,16 +13,17 @@
 neural;%0A
+%0A
 import j
@@ -43,39 +43,74 @@
 om;%0A
-public class GeneticMixer%7B%0A%0A/**
+%0A/**%0A * A class that handles the genetic mixing%0A *%0A * @author will
 %0A * 
@@ -266,15 +266,48 @@
 ome%0A
-%0A
+ *
 %0A */%0A%0A
+public class GeneticMixer%7B%0A%0A    
 publ
@@ -347,16 +347,19 @@
 dom();%0A%0A
+   
  public 
@@ -377,18 +377,35 @@
  start()
+ 
 %7B%0A
+        %0A       
  int one
@@ -407,16 +407,25 @@
 t one = 
+eco.Util.
 randInt(
@@ -426,24 +426,31 @@
 ndInt(1,5);%0A
+       
  int two = r
@@ -448,16 +448,25 @@
 t two = 
+eco.Util.
 randInt(
@@ -471,16 +471,23 @@
 t(1,5);%0A
+       
  int chi
@@ -519,24 +519,31 @@
 (one, two);%0A
+       
  System.out.
@@ -566,16 +566,23 @@
 + one);%0A
+       
  System.
@@ -609,16 +609,23 @@
 + two);%0A
+       
  System.
@@ -656,16 +656,23 @@
 child);%0A
+       
  System.
@@ -719,24 +719,31 @@
 ring(one));%0A
+       
  System.out.
@@ -790,16 +790,23 @@
 (two));%0A
+       
  System.
@@ -866,157 +866,26 @@
 );%0A 
-%7D%0A%0A public static int randInt(int min, int max) %7B //Returns a random number between min and max.%0A%0A return min + random.nextInt((max + 1)- min);%0A%0A %7D%0A%0A
+       %0A    %7D%0A%0A   
  pub
@@ -952,16 +952,32 @@
 tTwo) %7B%0A
+        %0A       
  int bas
@@ -1003,16 +1003,23 @@
 entTwo;%0A
+       
  Random 
@@ -1039,16 +1039,23 @@
 ndom();%0A
+       
  int pow
@@ -1101,16 +1101,23 @@
 F0000%7D;%0A
+       
  int exp
@@ -1145,16 +1145,23 @@
 8, 16%7D;%0A
+       
  int max
@@ -1195,16 +1195,23 @@
 ntTwo);%0A
+       
  int res
@@ -1219,16 +1219,23 @@
 lt = 0;%0A
+       
  System.
@@ -1252,16 +1252,32 @@
 n(max);%0A
+        %0A       
  for (in
@@ -1300,16 +1300,27 @@
  m--) %7B%0A
+           
  if ((ma
@@ -1341,16 +1341,31 @@
 )!=0) %7B%0A
+               
  max %3E%3E=
@@ -1379,16 +1379,31 @@
 nts%5Bm%5D;%0A
+               
  result 
@@ -1424,13 +1424,47 @@
 %5D;%0A 
-%7D%0A %7D%0A
+           %7D%0A        %7D%0A        %0A       
  res
@@ -1471,16 +1471,23 @@
 ult+=1;%0A
+       
  System.
@@ -1507,16 +1507,32 @@
 esult);%0A
+        %0A       
  for (in
@@ -1559,16 +1559,27 @@
  n ++)%7B%0A
+           
  if (((p
@@ -1608,16 +1608,31 @@
  == 0)%7B%0A
+               
  base %7C=
@@ -1684,14 +1684,39 @@
 0;%0A 
-%7D%0A%0A %7D%0A
+           %7D%0A%0A        %7D%0A       
  ret
@@ -1730,18 +1730,11 @@
 e;%0A 
-%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A
+   %7D
 %0A%7D%0A

Update GeneticMixer.java