@@ -0,0 +1,1496 @@
+package neural;%0Aimport java.util.Random;%0Apublic class GeneticMixer%7B%0A%0A/**%0A * @param parentOne the chromosome of the first parent%0A * @param parentTwo the chromosome of the second parent%0A * @return a new semirandom child chromosome%0A %0A %0A */%0A%0Apublic static Random random = new Random();%0A %0A public static void start()%7B%0A int one = randInt(1,5);%0A int two = randInt(1,5);%0A int child = spawnChildChromosome(one, two);%0A System.out.println(%22One: %22 + one);%0A System.out.println(%22Two: %22 + two);%0A System.out.println(%22Child: %22 + child);%0A System.out.println(%22One: %22 + Integer.toBinaryString(one));%0A System.out.println(%22Two: %22 + Integer.toBinaryString(two));%0A System.out.println(%22Child: %22 + Integer.toBinaryString(child));%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 public static int spawnChildChromosome(int parentOne, int parentTwo) %7B%0A int base = parentOne & parentTwo;%0A Random rand = new Random();%0A int powers2%5B%5D = %7B0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000%7D;%0A int exponents%5B%5D = %7B1, 2, 4, 8, 16%7D;%0A int max = Math.max(parentOne, parentTwo);%0A int result = 0;%0A System.out.println(max);%0A for (int m = 4; m %3E= 0; m--) %7B%0A if ((max & powers2%5Bm%5D)!=0) %7B%0A max %3E%3E= exponents%5Bm%5D;%0A result %7C= exponents%5Bm%5D;%0A %7D%0A %7D%0A result+=1;%0A System.out.println(result);%0A for (int n = 0; n %3C result; n ++)%7B%0A if (((parentOne%5EparentTwo)&n) == 0)%7B%0A base %7C= rand.nextInt(2)%3C%3Cn; // 0001; 0010; 0100; 1000;%0A %7D%0A %0A %7D%0A return base;%0A %7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%7D%0A

Create GeneticMixer.java