Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -537,6 +537,7 @@ class Game:
|
|
537 |
points_label = 0
|
538 |
self.ep_rewards = []
|
539 |
for episode in range(1, NUM_EPISODES + 1):
|
|
|
540 |
episode_reward = 0
|
541 |
step = 1
|
542 |
current_state = self.get_state()
|
@@ -593,7 +594,6 @@ class Game:
|
|
593 |
# pygame.quit()
|
594 |
self.obstacles.pop()
|
595 |
points_label = self.points
|
596 |
-
self.reset()
|
597 |
reward = -10
|
598 |
# print("Game over!")
|
599 |
self.run = False
|
@@ -630,11 +630,15 @@ class Game:
|
|
630 |
|
631 |
|
632 |
self.ep_rewards.append(episode_reward)
|
633 |
-
|
634 |
-
|
|
|
635 |
with logs_container:
|
636 |
-
st.text(f"Resumen del Episodio {episode}: Puntuación final {
|
637 |
|
|
|
|
|
|
|
638 |
# Obtenemos la fecha y hora actual
|
639 |
current_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
|
640 |
|
|
|
537 |
points_label = 0
|
538 |
self.ep_rewards = []
|
539 |
for episode in range(1, NUM_EPISODES + 1):
|
540 |
+
self.points = 0
|
541 |
episode_reward = 0
|
542 |
step = 1
|
543 |
current_state = self.get_state()
|
|
|
594 |
# pygame.quit()
|
595 |
self.obstacles.pop()
|
596 |
points_label = self.points
|
|
|
597 |
reward = -10
|
598 |
# print("Game over!")
|
599 |
self.run = False
|
|
|
630 |
|
631 |
|
632 |
self.ep_rewards.append(episode_reward)
|
633 |
+
if episode % 10 == 0:
|
634 |
+
with metrics_container:
|
635 |
+
plot_rewards(self.ep_rewards)
|
636 |
with logs_container:
|
637 |
+
st.text(f"Resumen del Episodio {episode}: Puntuación final {points_label}, Recompensa total {episode_reward}")
|
638 |
|
639 |
+
|
640 |
+
self.reset()
|
641 |
+
|
642 |
# Obtenemos la fecha y hora actual
|
643 |
current_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
|
644 |
|