I was trying to come up with a genetic system for my game. However, after doing the math I found the system I had in mind won't really work.
Characters have 5 stats that can range from 0 to 12. What I was planning on doing was averaging each stat, and then rolling two numbers for each. The one that would be inherited for each stat would be the one closest to the average.
However, I found the bias isn't that great. For any number between 0 and 12, there's a 23/144 chance, or about a 15% chance of it occurring. This means say that if the two parents had a 12 in a score, there was an 85% chance about that the offspring's score would be lower than 12. Clearly, that isn't going to work. If both parents have the highest number, the odds should be weighed far more towards them.
I could increase the number of rolls, but adding more rolls decreases the odds of the farthest result too much.
If it matters, I'm trying to recreate the genetic system of The Sims 2. I have no idea how it generated its results, other than that all possibilities would possible but somehow weighted based on the parents. The totals of all 5 stats were also always between 25 and 35. I know how that was accomplished, but it doesn't help me with the first part.
I did think of an alternate method, but I don't like it much either. I was thinking of taking the averages of the parents, and then incrementing every stat at random x times, then doing it again x times but this time decrementing. This however doesn't work too well either. Either it would heavily weigh scores towards the middle, or it would make it nigh impossible for a child to match its parent. If I added too many increments/decrements, it would probably result in the final stats bearing no resemblence to the parents. I may as well just be starting with 0, and incrementing stats at random until a total of 30 is reached.
What would be a good system for my game?
update: Thinking about the latter system, I've come to realize its inherently flawed. The problem comes from the fact that the program has to either increment or decrement first. I could have it alternate back and forth, but it may not help much. The issue arises in the fact that no value can be raised above 12. I solved this by having the problem just skip over stats that are 12 when its incrementing, and skipping over values of 0 when its decrementing. This means that if a stat is 0, it has a 0% chance of being incremented, and the other four have a 25% chance of being incremented. When it switches to decrementing, all have a 20% chance of being decremented (assuming none of them are zero of course). Thus the 12 stat is more likely to be decremented than incremented, while the remaining stats are more likely to incremented instead. Stats of 0 would suffer the same problem, but in reverse. This means that this system actually evens out the numbers, and makes it nigh impossible to have a stat of 12 or 0. In order for that to happen, the program would have to in its six tries not chose these stats all six times. That's less than 1/5000 chance about. So clearly this system sucks. Thus I need to pick something more neutral.
There does need to be a randomization element to it. If I just had all the offspring's stats be the average of its parents, then all siblings would have the exact same stats. There has to be some way for them to vary.