Click the green flag to generate a new list of genes, and press space to generate the gametes and combine them back into genes. If you want to keep on generating without you clicking space, just press “A” and it will automatically spam space for you. If you want to go back to manual space-bar mode without re-generating all the genes, press “M”.
This was an interesting project to make. Here are some things about it: The initial generation of the genes is made by having a 75% chance of having a recessive A allele, and a 50% chance of having a recessive B allele, making a recessive B phenotype much more rare than a recessive A phenotype. (Recessive is denoted with lowercase letters, like а and b, and dominant is denotes with UPPERCASE letters, like A and Ḇ.) This generates 4 gametes from each gene, which means there are going to be two times as many total individual alleles in the generated gametes, than the total individual alleles in the genes. So to keep the list length consistent, I made it so when the code combines the gametes back into genes, they only combine random elements of the gametes list UNTIL the original length of genes has been reached, and then the rest of the gametes are discarded. You can change the number of gametes per gene in the code, and it will automatically adjust the percentage of gametes to convert back into genes. I chose 840 for the initial number of genes generated just because it is divisible by all integers from 1-8 in a row. It makes the gamete and gene division more satisfying in my opinion. But you can make the initial number of genes anything you want. The lowercase а and uppercase Ḇ are kind of weird looking because they are alternative unicodes, as scratch cannot tell the difference between uppercase and lowercase to make it easier for kids to learn about string comparisons, and I have to tell them apart for the percent phenotype info on the bottom.