<commit_before>module Asteroids
  class AsteroidPhysics < Component

    def initialize(game_object, object_pool)
       super(game_object)
       @object_pool = object_pool
    end

    def update
      object.x += Gosu::offset_x(object.angle, 0.0001) + object.vel_x
      object.y += Gosu::offset_y(object.angle, 0.0001) + object.vel_y
      object.x %= 800
      object.y %= 600
    end

  end
end<commit_msg>Implement the collision detection for the asteroid.<commit_after>module Asteroids
  class AsteroidPhysics < Component

    def initialize(game_object, object_pool)
       super(game_object)
       @object_pool = object_pool
    end

    def update
      object.mark_for_removal if detect_collision?
      object.x += Gosu::offset_x(object.angle, 0.0001) + object.vel_x
      object.y += Gosu::offset_y(object.angle, 0.0001) + object.vel_y
      object.x %= 800
      object.y %= 600
    end

    def detect_collision?
      @object_pool.objects.each do |other_object|
        if other_object.is_a? Asteroids::Ship or
         other_object.is_a?  Asteroids::Missile and
          Utils.collide(object, other_object)
            return true
        end
      end
      return false
    end

  end
end
{'fraction_non_alphanumeric': 0.08512396694214876, 'fraction_numerical': 0.026446280991735537, 'mean_word_length': 2.6366366366366365, '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': '3301714', 'n_tokens_mistral': 429, 'n_tokens_neox': 384, 'n_words': 87}