My OpenAI playground
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

review.py 1011B

5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. from . import *
  2. def review(frames):
  3. sucs = ""
  4. prevSess = -1
  5. rew = 0
  6. cnt = 1
  7. try:
  8. for i, frame in enumerate(frames):
  9. out = u"{}[2J{}[;H".format(chr(27), chr(27))
  10. out += f"Session: {frame['session']}\n"
  11. out += frame['frame']
  12. out += f"Timestep: {i + 1}\n"
  13. out += f"State: {frame['state']}\n"
  14. out += f"Action: {frame['action']}\n"
  15. out += f"Reward: {frame['reward']}\n"
  16. sess = frame['session']
  17. if sess != prevSess:
  18. if rew > 0:
  19. sucs += "+"
  20. sleep(1)
  21. elif rew < 0:
  22. sucs += "-"
  23. elif prevSess >= 0:
  24. sucs += "."
  25. prevSess = frame['session']
  26. cnt += 1
  27. rew = frame['reward']
  28. out += f"\nSuccesses: [{sucs}]\n"
  29. print(out)
  30. sleep(.1)
  31. except KeyboardInterrupt:
  32. return()