(self, action)
| 85 | return list(self.agent) |
| 86 | |
| 87 | def step(self, action): |
| 88 | x, y = self.agent |
| 89 | if action == 0 and y > 0: y -= 1 |
| 90 | elif action == 1 and y < HEIGHT - 1: y += 1 |
| 91 | elif action == 2 and x > 0: x -= 1 |
| 92 | elif action == 3 and x < WIDTH - 1: x += 1 |
| 93 | self.agent = [x, y] |
| 94 | self.steps += 1 |
| 95 | if self.agent == self.goal: |
| 96 | self.last_reward = 100 |
| 97 | return list(self.agent), 100, True |
| 98 | if self.agent in self.obstacles: |
| 99 | self.last_reward = -100 |
| 100 | return list(self.agent), -100, True |
| 101 | return list(self.agent), 0, False |
| 102 | |
| 103 | def print_value_all(self, q_table): |
| 104 | self.q_overlay = q_table |
no outgoing calls
no test coverage detected