(grid, n_episodes=1000)
| 41 | |
| 42 | |
| 43 | def gather_samples(grid, n_episodes=1000): |
| 44 | samples = [] |
| 45 | for _ in range(n_episodes): |
| 46 | s = grid.reset() |
| 47 | while not grid.game_over(): |
| 48 | a = np.random.choice(ALL_POSSIBLE_ACTIONS) |
| 49 | sa = merge_state_action(s, a) |
| 50 | samples.append(sa) |
| 51 | |
| 52 | r = grid.move(a) |
| 53 | s = grid.current_state() |
| 54 | return samples |
| 55 | |
| 56 | |
| 57 | class Model: |
no test coverage detected