Skip to content

Commit

Permalink
add GP cancel rewards back. Add ball towards goal check for truncation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiyotech committed Jun 23, 2023
1 parent 260043b commit 1778b06
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 170 deletions.
7 changes: 7 additions & 0 deletions mybots_terminals.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def __init__(self, avg_frames, avg_frames_per_mode=None, min_frames=10):
self.rng = np.random.default_rng()
self.check_length = None
self.min_frames = min_frames
self.checked_goal = False

def reset(self, initial_state: GameState):
self.steps = 0
Expand All @@ -140,9 +141,15 @@ def reset(self, initial_state: GameState):
self.check_length = self.frames[0]
self.check_length = self.check_length + ((self.check_length / 4) * self.rng.standard_normal())
self.check_length = max(self.check_length, self.min_frames)
self.checked_goal = False

def is_terminal(self, current_state: GameState) -> bool:
self.steps += 1
if not self.checked_goal and self.steps > self.check_length and current_state.ball.position[2] < 300:
self.checked_goal = True
if ball_towards_goal(current_state.ball, 1100, True):
self.check_length += 60
return False
return self.steps > self.check_length and current_state.ball.position[2] < 300


Expand Down
Loading

0 comments on commit 1778b06

Please sign in to comment.