
import time
import env
import rl

rl.load_q()
env.make("pygame")

while True:
    env.reset()
    for _ in range(15):
        if env.done:
            break
        action = rl.choose_action(rl.table[env.object[0]])
        env.action(action)
        time.sleep(0.03)
        env.render()


import time
import env
import rl

rl.load_q()
env.make("pygame")

while True:
    env.reset()
    for _ in range(15):
        if env.done:
            break
        action = rl.choose_action(env.player, "test")
        env.action(action)
        time.sleep(0.03)
        env.render()

Update to newest version of rl.py.
Update to newest version of rl.py.

  
  import time
  import env
  import rl
  
  rl.load_q()
  env.make("pygame")
  
  while True:
      env.reset()
      for _ in range(15):
          if env.done:
              break
-         action = rl.choose_action(rl.table[env.object[0]])
+         action = rl.choose_action(env.player, "test")
          env.action(action)
          time.sleep(0.03)
          env.render()
  
Update to newest version of rl.py.
## Code Before:

import time
import env
import rl

rl.load_q()
env.make("pygame")

while True:
    env.reset()
    for _ in range(15):
        if env.done:
            break
        action = rl.choose_action(rl.table[env.object[0]])
        env.action(action)
        time.sleep(0.03)
        env.render()

## Instruction:
Update to newest version of rl.py.
## Code After:

import time
import env
import rl

rl.load_q()
env.make("pygame")

while True:
    env.reset()
    for _ in range(15):
        if env.done:
            break
        action = rl.choose_action(env.player, "test")
        env.action(action)
        time.sleep(0.03)
        env.render()
