Skip to content

Instantly share code, notes, and snippets.

View sebastianbourges's full-sized avatar

Sebastian Bourges sebastianbourges

View GitHub Profile
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