Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Some Help

Code:
```for(\$i=1; \$i < \$array.length; \$i++){
for(\$j=1; \$j < \$array1.length; \$j++){
if(\$array[\$i] && \$array1[\$j] == \$dominant){
//code
}elseif(\$array[\$i] == \$dominant && \$array[\$j] == \$recessive){
//code
}elseif(\$array[\$i]==\$recessive && \$array[\$j] == \$dominant){
//code
}elseif(\$array[\$i] && \$array1[\$j] == \$recessive){
//code
}else{
die;
}
}
}```
Basically with this, I'm taking user input (From dropdown boxes, so no worries on if it'll screw up) , and putting it into array and array1. Then i'm running through these arrays, and checking if each value is dominant or recessive and comparing them. Basically now, i'm trying to figure out how to add to the probability of each thing getting pulled out. The only problem is, there may be more than one dominant or recessive for each subset, and they need to stay separate. Where it says //code, could I do something like :

Check to determine what kind of trait it is
Then add to something like \$Trait1Final
Then take all of the "Final" vars and put them in to an array and use the maths to get the probability of drawing one?

Basically, I'm trying to make this

http://gyazo.com/eb9fcebd9557903f4c57da7e8f7b396c

Thanks for any help .

• So you have a 2-dimensional array ... across (columns) and down (rows)?

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•