Featherance says to OwO/ruby_interactive@mmis_js_bot target = (0..9).to_a.shuffle.shift(4).map(&:to_s) loop do line = readline.chomp break unless line next unless line =~ /^\d{4}$/ cross = line.chars & target a, b = 0, 0 unless cross.empty? cross.each do |c| if target.index(c) == line.index(c) a += 1 else b += 1 end end end puts "%dA%dB" % [a, b] break if a == 4 endat Tue, Oct 31, 2017 2:22 PM