A Pen by Sebastian Bourges on CodePen.
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |