<commit_before>class Snake:
  attr_accessor :body, :food_eaten

  def initialize(start_x, start_y)
    @food_eaten = false
    x, y = start_x, start_y
    @body.insert(-1, [x, y])
    @body.insert(-1, [x-1, y])
    @body.insert(-1, [x-2, y])
    @body.insert(-1, [x-3, y])
  end

  def get_head
    return @body.first.dup
  end

  def food_eaten?
    return @food_eaten
  end

  def move_up
    head_x, head_y = get_head
    @body.insert(0, [head_x, head_y-1])
    @body.delete_at(-1) unless food_eaten?
  end

  def move_down
  end

  def move_left
  end

  def move_right
  end 
end




<commit_msg>adds move[up, down, left and right] methods<commit_after>class Snake:
  attr_accessor :body, :food_eaten

  def initialize(start_x, start_y)
    @food_eaten = false
    x, y = start_x, start_y
    @body.insert(-1, [x, y])
    @body.insert(-1, [x-1, y])
    @body.insert(-1, [x-2, y])
    @body.insert(-1, [x-3, y])
  end

  def get_head
    return @body.first.dup
  end

  def food_eaten?
    return @food_eaten
  end

  def eat_food
    @food_eaten = true
  end

  def done_eating_food
    @food_eaten = false
  end

  def move_up
    head_x, head_y = get_head
    @body.insert(0, [head_x, head_y-1])
    if food_eaten?
      done_eating_food
    else
      @body.delete_at(-1)
    end
  end

  def move_down
    head_x, head_y = get_head
    @body.insert(0, [head_x, head_y-1])
    if food_eaten?
      done_eating_food
    else
      @body.delete_at(-1)
    end
  end

  def move_left
    head_x, head_y = get_head
    @body.insert(0, [head_x-1, head_y])
    if food_eaten?
      done_eating_food
    else
      @body.delete_at(-1)
    end
  end

  def move_right
    head_x, head_y = get_head
    @body.insert(0, [head_x+1, head_y])
    if food_eaten?
      done_eating_food
    else
      @body.delete_at(-1)
    end
  end 

end





{'fraction_non_alphanumeric': 0.11473626971179988, 'fraction_numerical': 0.015769439912996192, 'mean_word_length': 2.4264432029795158, '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': '3412453', 'n_tokens_mistral': 797, 'n_tokens_neox': 772, 'n_words': 173}