def main2(): """ Looks at which games are possible after a certain number of differences. """ GAME_LENGTH = 16 # possible_tuples[i] is the set of tuples for which there exists a game # whose ith element is that tuple possible_tuples = [] for n in range(0, 2 ** GAME_LENGTH): g = int_to_game(n, GAME_LENGTH) sim = Simulator(g) assert sim.get_game_length() is not None, 'Non-terminating game: %s' % g t = 0 while not sim.done(): if t >= len(possible_tuples): possible_tuples.append(set()) possible_tuples[t].add(tuple(sim.state)) sim.step_forward() t += 1 # Add ending tuple as well if t >= len(possible_tuples): possible_tuples.append(set()) possible_tuples[t].add(tuple(sim.state)) print 'Number of possible tuples after t steps:' for t in range(len(possible_tuples)): print '%d: %d' % (t, len(possible_tuples[t]))