|
12345678910111213141516171819202122232425262728293031323334353637 |
- from . import *
-
- def review(frames):
- sucs = ""
- prevSess = -1
- rew = 0
- cnt = 1
-
- try:
- for i, frame in enumerate(frames):
- out = u"{}[2J{}[;H".format(chr(27), chr(27))
- out += f"Session: {frame['session']}\n"
- out += frame['frame']
- out += f"Timestep: {i + 1}\n"
- out += f"State: {frame['state']}\n"
- out += f"Action: {frame['action']}\n"
- out += f"Reward: {frame['reward']}\n"
-
- sess = frame['session']
- if sess != prevSess:
- if rew > 0:
- sucs += "+"
- sleep(1)
- elif rew < 0:
- sucs += "-"
- elif prevSess >= 0:
- sucs += "."
- prevSess = frame['session']
- cnt += 1
- rew = frame['reward']
-
- out += f"\nSuccesses: [{sucs}]\n"
- print(out)
- sleep(.1)
-
- except KeyboardInterrupt:
- return()
|