from pylab import * from scipy.ndimage import filters , measurements import pygame from pygame import surfarray matplotlib . rc ( "image" , cmap = "gray" ) matplotlib . rc ( "image" , interpolation = "nearest" ) pygame . init () OR = logical_or AND = logical_and def unif ( lo , hi , size = 1 ): if size == 1 : return rand () * ( hi - lo ) + lo if type ( size ) == int : return rand ( size ) * ( hi - lo ) + lo return rand ( * size ) * ( hi - lo ) + lo