I am extremely new to coding and I am currently learning C# on my own. I have searched around but I cannot find what I am looking for. I may not be searching for the correct terms.
I am wondering how I could swap sections of 2 different 2d arrays, with each other, and form a new (child) 2d array.
I plan on using this in an evolution simulation, however what I am trying to do is not the same as a Genetic Algorithm. I do not care about spawning populations, fitness functions, etc.
So the basic idea is that I want to take two existing 2d arrays that are each 20 rows (genes) x 2 columns (A/B options), swap random sections, and then spawn the child 2d array of the same size.
Ideally I would like this to be similar to the Uniform Crossover in Genetics where the data isn't simply split in half. I would need the arrays to have corresponding data locations so to be used as "swap points" for the data. I also want the original "parent" arrays to remain in existence, while the child array is created.
A chromosome made of an array 20 genes, with each gene containing an array of 2 alleles.
[Chromosome]--->[Gene]--->[Allele]
Each gene represents things like color, size, and behaviors. Each gene has an A/B option (allele). These A/B options will be used later to determine "behaviors."
(Alleles that are swapped are capitalized)
Parent 1: [a,A,b,b,B,a,A,b,a,a,a,b,a,b,a,a,a,b,a,a]
Parent 2: [a,B,b,b,A,a,B,b,a,a,a,b,a,b,a,a,a,b,a,a]
Child 1: [a,A,b,b,B,a,B,b,a,a,a,b,a,b,a,a,a,b,a,a]
Notice how the data swapped at random corresponding points (loci). Also notice how a good chunk of the data remains the same. I would like to eventually add a "relatedness" check that determines what percentage the two original arrays have in common. This would be how I will choose the "parents" + their proximity to each other in the simulation.
I would then need to figure out a way to tie individual methods to each A/B for each gene in order to execute the behaviors. (ex. MovementSpeedGene - A = add Random Range (0,2) to Movement Speed)
Any and all help is much appreciated!