(grid, n_episodes=10000)
| 28 | |
| 29 | |
| 30 | def gather_samples(grid, n_episodes=10000): |
| 31 | samples = [] |
| 32 | for _ in range(n_episodes): |
| 33 | s = grid.reset() |
| 34 | samples.append(s) |
| 35 | while not grid.game_over(): |
| 36 | a = np.random.choice(ALL_POSSIBLE_ACTIONS) |
| 37 | r = grid.move(a) |
| 38 | s = grid.current_state() |
| 39 | samples.append(s) |
| 40 | return samples |
| 41 | |
| 42 | |
| 43 | class Model: |
no test coverage detected