<commit_before>require_relative '../concepts/game_state'
require_relative '../concepts/player_state'
require_relative '../services/apply_action'

class Game < ActiveRecord::Base
  has_many :players

  after_initialize :setup_state

  def actions
    # TODO: optimize
    players.all
           .flat_map { |player| player.actions }
           .sort_by { |action| action.id }<commit_msg>Add documentation for weird method in 'Game'<commit_after>require_relative '../concepts/game_state'
require_relative '../concepts/player_state'
require_relative '../services/apply_action'

class Game < ActiveRecord::Base
  has_many :players

  after_initialize :setup_state

  def actions
    # TODO: optimize
    # We must sort the actions by ID so that they are
    # in chronological order, otherwise the game will break.
    players.all
           .flat_map { |player| player.actions }
           .sort_by { |action| action.id }
{'fraction_non_alphanumeric': 0.09586056644880174, 'fraction_numerical': 0.0, 'mean_word_length': 3.4396135265700485, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5678131', 'n_tokens_mistral': 269, 'n_tokens_neox': 260, 'n_words': 73}