<commit_before>module CodeBreaker

  class Game
    attr_accessor :secret_code, :available_hints, :move
    def initialize 
      @secret_code     = ""
      @available_hints = 4
      @move            = 5
    end 

    def start
      @secret_code = generate_code
    end

    def generate_code
      4.times { @secret_code += "#{rand(1..6)}"}
      @secret_code
    end

    def check_number input_number
      @move             -= 1
      result             = String.new
      code_without_eql   = String.new
      input_without_eql  = String.new

      return "something wrong with your number" if input_number.size != 4
      return "fail number" unless input_number.match(/^[1-6]{1,4}/)

      for i in 0...4
        if input_number[i] == @secret_code[i]
          result << "+"
        else
        code_without_eql << @secret_code[i]
        input_without_eql << input_number[i]
        end
      end

      input_without_eql.each_char do |arg|
       if code_without_eql.include? arg
           result << "-"
           input_without_eql.slice!(arg) 
           code_without_eql.slice!(arg)
        end
      end
      return "Game over" if @move == 0
      return "You win" if result == "++++"
      result
    end

    def get_hint
      return "you have no hints" if @available_hints == 0
      @available_hints -= 1
      position = rand(4)
      "Number from secret code - #{@secret_code[position]}. You have #{@available_hints} hints"
    end

  end

end
<commit_msg>Update game.rb<commit_after>module CodeBreaker

  class Game
    attr_accessor :secret_code, :available_hints, :move
    def initialize 
      @secret_code     = ""
      @available_hints = 4
      @move            = 5
    end 

    def start
      @secret_code = generate_code
    end

    def generate_code
      4.times { @secret_code += "#{rand(1..6)}"}
      @secret_code
    end

    def check_number input_number
      @move             -= 1
      result             = String.new
      code_without_eql   = String.new
      input_without_eql  = String.new

      return "something wrong with your number" if input_number.size != 4
      return "fail number" unless input_number.match(/^[1-6]{1,4}/)

      for i in 0...4
        if input_number[i] == @secret_code[i]
          result << "+"
        else
        code_without_eql << @secret_code[i]
        input_without_eql << input_number[i]
        end
      end

      input_without_eql.each_char do |arg|
       if code_without_eql.include? arg
           result << "-"
           input_without_eql.slice!(arg) 
           code_without_eql.slice!(arg)
        end
      end
      return "Game over" if @move < 0
      return "You win" if result == "++++"
      result
    end

    def get_hint
      return "you have no hints" if @available_hints == 0
      @available_hints -= 1
      position = rand(4)
      "Number from secret code - #{@secret_code[position]}. You have #{@available_hints} hints"
    end

  end

end

{'fraction_non_alphanumeric': 0.09716599190283401, 'fraction_numerical': 0.011470985155195682, 'mean_word_length': 1.9211822660098523, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4193271', 'n_tokens_mistral': 966, 'n_tokens_neox': 921, 'n_words': 237}