Skip to content

Instantly share code, notes, and snippets.

@alexgolec
Last active November 20, 2018 17:26
Show Gist options
  • Save alexgolec/b3cbe68396f503d53244c767be8c8070 to your computer and use it in GitHub Desktop.
Save alexgolec/b3cbe68396f503d53244c767be8c8070 to your computer and use it in GitHub Desktop.
NEIGHBORS_MAP = {
1: (6, 8),
2: (7, 9),
3: (4, 8),
4: (3, 9, 0),
5: tuple(), # 5 has no neighbors
6: (1, 7, 0),
7: (2, 6),
8: (1, 3),
9: (2, 4),
0: (4, 6),
}
def neighbors(position):
return NEIGHBORS_MAP[position]
@perk11
Copy link

perk11 commented Oct 9, 2018

Yes, there is definitely a mistake for the mapping 4

@alexgolec
Copy link
Author

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment