<commit_before>module Tennis
  class Game3
    def initialize(player1Name, player2Name)
      @p1N = player1Name
      @p2N = player2Name
      @p1 = 0
      @p2 = 0
    end

    def won_point(n)
      if n == @p1N
        @p1 += 1
      else
        @p2 += 1
      end
    end

    def score
      if (@p1 < 4 and @p2 < 4) and (@p1 + @p2 < 6)
        p = ["Love", "Fifteen", "Thirty", "Forty"]
        s = p[@p1]
        @p1 == @p2 ? s + "-All" : s + "-" + p[@p2]
      else
        if (@p1 == @p2)
          "Deuce"
        else
          s = @p1 > @p2 ? @p1N : @p2N
          (@p1-@p2)*(@p1-@p2) == 1 ? "Advantage " + s : "Win for " + s
        end
      end
    end
  end
end<commit_msg>Refactored Tennis::Game3 class: Declared readonly variables, Better variable and method names, Better spacing and formats<commit_after>module Tennis
  class Game3
    attr_accessor :first_player_name, :second_player_name, :first_player_points, :second_player_points

    def initialize(first_player_name, second_player_name)
      @first_player_name = first_player_name
      @second_player_name = second_player_name
      @first_player_points = 0
      @second_player_points = 0
    end

    def score
      if (first_player_points < 4 && second_player_points < 4) && (first_player_points + second_player_points < 6)
        points = %w(Love Fifteen Thirty Forty)
        score = points[first_player_points]
        first_player_points == second_player_points ? score + '-All' : score + '-' + points[second_player_points]
      else
        if first_player_points == second_player_points
          'Deuce'
        else
          player_in_advantage = first_player_points > second_player_points ? first_player_name : second_player_name
          (first_player_points - second_player_points) * (first_player_points - second_player_points) == 1 ? "Advantage #{player_in_advantage}" : "Win for #{player_in_advantage}"
        end
      end
    end

    def won_point(player_name)
      if player_name == first_player_name
        @first_player_points += 1
      else
        @second_player_points += 1
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09872461029759093, 'fraction_numerical': 0.02267359470949457, 'mean_word_length': 2.432739059967585, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '4367529', 'n_tokens_mistral': 728, 'n_tokens_neox': 703, 'n_words': 171}