(env, pmodel, gamma)
| 176 | |
| 177 | |
| 178 | def play_one(env, pmodel, gamma): |
| 179 | observation = env.reset() |
| 180 | done = False |
| 181 | totalreward = 0 |
| 182 | iters = 0 |
| 183 | |
| 184 | while not done and iters < 2000: |
| 185 | # if we reach 2000, just quit, don't want this going forever |
| 186 | # the 200 limit seems a bit early |
| 187 | action = pmodel.sample_action(observation) |
| 188 | # oddly, the mountain car environment requires the action to be in |
| 189 | # an object where the actual action is stored in object[0] |
| 190 | observation, reward, done, info = env.step([action]) |
| 191 | |
| 192 | totalreward += reward |
| 193 | iters += 1 |
| 194 | return totalreward |
| 195 | |
| 196 | |
| 197 | def play_multiple_episodes(env, T, pmodel, gamma, print_iters=False): |
no test coverage detected