lib/mastermind/knuth.rb
# 2. Make initial guess of 1122
2. Make initial guess of 1122
2 . Make initial guess of 1122
def first_guess
      first_color = Game::Piece::COLORS.sample
      second_color = Game::Piece::COLORS.reject { |color| color == first_color }.sample
      sequence = Array.new(@game.secret_length) do |position|
        position < @game.secret_length / 2 ? first_color : second_color
      end
      Game::Code.from(sequence)
    end
def first_guess first_color = Game :: Piece :: COLORS . sample second_color = Game :: Piece :: COLORS . reject { | color | color == first_color } . sample sequence = Array . new ( @game . secret_length ) do | position | position < @game . secret_length / 2 ? first_color : second_color end Game :: Code . from ( sequence ) end
2.
2 .