Featherance says to OwO
/ruby_interactive@mmis_js_bot require "readline" target = (0..9).to_a.shuffle.shift(4).map(&:to_s) loop do line = Readline.readline 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 puts "%dA%dB" % [a, b] break if a == 4 end