0.upto(999).each do |n| puts format('%03d', n) exit if gets.chomp == 'unlocked' end