(self, s, a)
| 41 | return (self.i, self.j) |
| 42 | |
| 43 | def get_next_state(self, s, a): |
| 44 | # this answers: where would I end up if I perform action 'a' in state 's'? |
| 45 | i, j = s[0], s[1] |
| 46 | |
| 47 | # if this action moves you somewhere else, then it will be in this dictionary |
| 48 | if a in self.actions[(i, j)]: |
| 49 | if a == 'U': |
| 50 | i -= 1 |
| 51 | elif a == 'D': |
| 52 | i += 1 |
| 53 | elif a == 'R': |
| 54 | j += 1 |
| 55 | elif a == 'L': |
| 56 | j -= 1 |
| 57 | return i, j |
| 58 | |
| 59 | def move(self, action): |
| 60 | # check if legal move first |
no outgoing calls
no test coverage detected