from numpy import matrix from math import trunc from math import sqrt table1=matrix([[0,1],[0,1]]) def size(a): return trunc(sqrt(a.size)) def inrange(a,b,max): return a>=0 and b>=0 and a