Returns a list of coordinates of neighbors adjacent to the current coordinates. Neighbors: | 0 | 1 | 2 | | 3 | _ | 4 | | 5 | 6 | 7 |
(self)
| 35 | return self.function(self.x, self.y) |
| 36 | |
| 37 | def get_neighbors(self): |
| 38 | """ |
| 39 | Returns a list of coordinates of neighbors adjacent to the current coordinates. |
| 40 | |
| 41 | Neighbors: |
| 42 | | 0 | 1 | 2 | |
| 43 | | 3 | _ | 4 | |
| 44 | | 5 | 6 | 7 | |
| 45 | """ |
| 46 | step_size = self.step_size |
| 47 | return [ |
| 48 | SearchProblem(x, y, step_size, self.function) |
| 49 | for x, y in ( |
| 50 | (self.x - step_size, self.y - step_size), |
| 51 | (self.x - step_size, self.y), |
| 52 | (self.x - step_size, self.y + step_size), |
| 53 | (self.x, self.y - step_size), |
| 54 | (self.x, self.y + step_size), |
| 55 | (self.x + step_size, self.y - step_size), |
| 56 | (self.x + step_size, self.y), |
| 57 | (self.x + step_size, self.y + step_size), |
| 58 | ) |
| 59 | ] |
| 60 | |
| 61 | def __hash__(self): |
| 62 | """ |
no test coverage detected