<commit_before>class Grid

  def initialize(params = {})
    params = {program_file: nil}.merge(params)
    Params.check_params(params, [:window, :user, :map_file, :tileset])

    @window, @user = params[:window], params[:user]
    @map = Map.new(window: @window,
                   map_file: params[:map_file],
                   tileset: params[:tileset])

    if params[:program_file]
      create_programs(params[:program_file])
    end
  end

  def update
  end

  def draw
    @map.draw
  end

  def width
    @map.width
  end

  def height
    @map.height
  end

  def solid_blocks
    @map.solid_blocks
  end

  def map_in_lines
    @map.map_in_lines
  end

  private

  def create_programs(program_file)
    program_map = ProgramMap.new(program_file)
    n = 0
    programs = []

    program_map.map_in_columns.each do |column|
      if column.include?("s")
        n += 1
        programs.push(n)
      end
    end

    programs.each do |number|
      id = 'program_' + number.to_s
      instance_variable_set("@#{id}", Program.new)
    end
  end

end<commit_msg>Add 'module Poke' to grid.rb<commit_after>module Poke

  class Grid

    def initialize(params = {})
      params = {program_file: nil}.merge(params)
      Params.check_params(params, [:window, :user, :map_file, :tileset])

      @window, @user = params[:window], params[:user]
      @map = Map.new(window: @window,
                     map_file: params[:map_file],
                     tileset: params[:tileset])

      if params[:program_file]
        create_programs(params[:program_file])
      end
    end

    def update
    end

    def draw
      @map.draw
    end

    def width
      @map.width
    end

    def height
      @map.height
    end

    def solid_blocks
      @map.solid_blocks
    end

    def map_in_lines
      @map.map_in_lines
    end

    private

    def create_programs(program_file)
      program_map = ProgramMap.new(program_file)
      n = 0
      programs = []

      program_map.map_in_columns.each do |column|
        if column.include?("s")
          n += 1
          programs.push(n)
        end
      end

      programs.each do |number|
        id = 'program_' + number.to_s
        instance_variable_set("@#{id}", Program.new)
      end
    end

  end

end
{'fraction_non_alphanumeric': 0.10435931307793923, 'fraction_numerical': 0.0017613386173491853, 'mean_word_length': 2.133793103448276, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1950769', 'n_tokens_mistral': 774, 'n_tokens_neox': 747, 'n_words': 166}