(index)
| 16 | |
| 17 | # returns (y, x), index is 0-3 referencing north-west |
| 18 | def get_offset(index): |
| 19 | return [ |
| 20 | (-1, 0), # north |
| 21 | (0, 1), # east |
| 22 | (1, 0), # south |
| 23 | (0, -1) # west |
| 24 | ][index] |
| 25 | |
| 26 | # the opposite direction's index |
| 27 | def get_opposite_index(index): |