Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
import itertools | |
from collections import defaultdict | |
GRID_SIZE = 3 | |
on_grid = lambda (a, b) : (0 <= a < GRID_SIZE) and (0 <= b < GRID_SIZE) | |
def gen_neighbours((a, b)): | |
for i, j in itertools.product((-1, 0, 1), repeat=2): | |
a_prime = a + i |