Skip to content

Commit

Permalink
modified bullet extraction with match_blinking_objects
Browse files Browse the repository at this point in the history
  • Loading branch information
azimpour102 authored Dec 2, 2024
1 parent 9f0b482 commit 0346936
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ocatari/vision/spaceinvaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class Bullet(GameObject):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.rgb = 142, 142, 142
self.num_frames_invisible = -1
self.max_frames_invisible = 2


class P1Score(GameObject):
Expand Down Expand Up @@ -81,7 +83,7 @@ def _detect_objects(objects, obs, hud):
match_objects(objects, shields_bb, 1, 3, Shield)

bullets_bb = find_objects(obs, objects_colors["bullet"])
match_objects(objects, bullets_bb, 4, 3, Bullet)
match_blinking_objects(objects, bullets_bb, 4, 3, Bullet)

satellites_bb = find_objects(obs, objects_colors["satellite"])
match_objects(objects, satellites_bb, 7, 1, Satellite)
Expand Down Expand Up @@ -116,4 +118,4 @@ def _detect_objects(objects, obs, hud):
else:
objects[46] = Lives(*lives_bb[0])
elif lives:
objects[46] = NoObject()
objects[46] = NoObject()

0 comments on commit 0346936

Please sign in to comment.