# # Check how quickly things converge to uniform # Bryan Clair, June 2012 # from HardcoreGrid import HardcoreGrid trials = 10000 steps = 100 results = dict() for trial in range(trials): g = HardcoreGrid(3,2) for t in range(steps): changed = g.oneStepGlauber() if str(g) in results: results[str(g)] += 1 else: results[str(g)] = 1 print 'After',trials,'runs, each with',steps,'steps, the percentages were:' for r in results: print r, 100*results[r]/float(trials) print