Skip to content

Instantly share code, notes, and snippets.

View tclarke's full-sized avatar

Trevor R.H. Clarke tclarke

View GitHub Profile
@tclarke
tclarke / maze.py
Created February 16, 2014 20:50
Cellular Automata 2D Maze Generator
import numpy as np
import cv2
# cellular automata class based on code from http://www.loria.fr/~rougier/teaching/numpy/scripts/game-of-life-numpy.py
class CA(object):
def __init__(self, s, b, shape, init_fill=0.1):
assert(type(s) == type([]) and type(b) == type([]))
self.s,self.b = s,b
self.z = (np.random.random(shape) < init_fill).astype("uint8")