lib/individual.rb
# Each bit of first parent is checked with bit of second parent whether they are same.
# If same then the bit is taken for the offspring otherwise the bit from the third parent
# is taken for the offspring.

Each bit of first parent is checked with bit of second parent whether they are same.
If same then the bit is taken for the offspring otherwise the bit from the third parent
is taken for the offspring.
Each bit of first parent is checked with bit of second parent whether they are same . If same then the bit is taken for the offspring otherwise the bit from the third parent is taken for the offspring .
def three_parent_crossover(ary1, ary2, ary3)
    tmp_ary = []
    ary1.size.times do |i|
      if ary1[i] == ary2[i]
        tmp_ary[i] = ary2[i]
      else
        tmp_ary[i] = ary3[i]
      end
    end
    return tmp_ary
  end
def three_parent_crossover ( ary1 , ary2 , ary3 ) tmp_ary = [ ] ary1 . size . times do | i | if ary1 [ i ] == ary2 [ i ] tmp_ary [ i ] = ary2 [ i ] else tmp_ary [ i ] = ary3 [ i ] end end return tmp_ary end
Each bit of first parent is checked with bit of second parent whether they are same.
Each bit of first parent is checked with bit of second parent whether they are same .
ary1
<not_specific>
ary2
<not_specific>
ary3
<not_specific>