Featherance says to OwO
/ruby_interactive@mmis_js_bot require "readline" require "io/console" target = (0..9).to_a.shuffle.shift(4).map(&:to_s) STDIN.echo = false STDOUT.sync = true 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 end puts "%dA%dB" % [a, b] break if a == 4 end