<commit_before>class Player < ActiveRecord::Base

  belongs_to :play
  scope :with_play, -> { eager_load(:play) }

  # :: [Int]
  def decision_array
    @_decision_array ||= JSON.parse(decision)
  end

  # :: (Int, Int) -> Nil
  def decide(step, value)
    if play.decision_of(step)
      Rails.logger.error "Already answered."
      return
    end
    ary = decision_array
    ary[step - 1] = value
    self.decision = ary.to_json
    save!
  end
  # :: Play -> Int
  def total_score(play)
    sum = 0;
    play.decision_array.each_with_index{|v, i|
      sum += 1 if v == decision_array[i]
    }
    sum
  end
end<commit_msg>[#13] Exclude an example from total score<commit_after>class Player < ActiveRecord::Base

  belongs_to :play
  scope :with_play, -> { eager_load(:play) }

  # :: [Int]
  def decision_array
    @_decision_array ||= JSON.parse(decision)
  end

  # :: (Int, Int) -> Nil
  def decide(step, value)
    if play.decision_of(step)
      Rails.logger.error "Already answered."
      return
    end
    ary = decision_array
    ary[step - 1] = value
    self.decision = ary.to_json
    save!
  end
  # :: Play -> Int
  def total_score(play)
    sum = 0;
    play.decision_array.each_with_index{|v, i|
      sum += 1 if v == decision_array[i] && i != 0 # exclude an example
    }
    sum
  end
end
{'fraction_non_alphanumeric': 0.12490479817212491, 'fraction_numerical': 0.006854531607006854, 'mean_word_length': 2.66016713091922, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '192802', 'n_tokens_mistral': 493, 'n_tokens_neox': 459, 'n_words': 114}