Page 1 of 1

Some Help

Posted: Sat May 18, 2013 10:23 am
by Xaos

Code: Select all

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 .

Re: Some Help

Posted: Sat May 18, 2013 10:41 am
by vitinho444
Ahh i learnt that in this year (12th grade) is Mendel's chess right?

Ok, since i know what you want i need to know something more, like what input will you be analyzing?

Re: Some Help

Posted: Sat May 18, 2013 10:46 am
by Xaos
vitinho444 wrote:Ahh i learnt that in this year (12th grade) is Mendel's chess right?

Ok, since i know what you want i need to know something more, like what input will you be analyzing?
The user's going to be able to select dropdown boxes and choose. They'll all be strings

Re: Some Help

Posted: Sat May 18, 2013 7:26 pm
by vitinho444
Yeah, but what will be in those dropboxs? It's the genotype?

Re: Some Help

Posted: Sat May 18, 2013 7:39 pm
by Xaos
vitinho444 wrote:Yeah, but what will be in those dropboxs? It's the genotype?
Yeah itll be something like a characteristic....it'll be something like the user will have the option to choose say Hair and Eye color (there will be more, but for example purposes) then the dropdown will have one "mother" side and one "father" side and it'll have characteristics like Brown, Blonde, etc. (for hair).

Re: Some Help

Posted: Sat May 18, 2013 11:03 pm
by vitinho444
Xaos wrote:
vitinho444 wrote:Yeah, but what will be in those dropboxs? It's the genotype?
Yeah itll be something like a characteristic....it'll be something like the user will have the option to choose say Hair and Eye color (there will be more, but for example purposes) then the dropdown will have one "mother" side and one "father" side and it'll have characteristics like Brown, Blonde, etc. (for hair).
Hum.. im really sorry but i was not thinking about that :S

I'm so ashamed right now for not helping you like i was thinking.. :( :oops: :x

Very Sorry..