# frozen_string_literal: true require_relative 'config' module CodebreakerDiz class Matcher class << self def calculate_matches(secret, user_code) delta = [] result = [] (0...CODE_LENGTH).each do |i| if secret[i] == user_code[i] then result << EXACT_MATCH_SIGN elsif (secret - delta).include? user_code[i] then result << NUMBER_MATCH_SIGN end delta << user_code[i] end result.sort!.join end end end end