def transitions_old(width, height, configs=None, one_per_state=False):
digit = width * height
if configs is None:
configs = generate_configs(digit)
if one_per_state:
def pickone(thing):
index = np.random.randint(0,len(thing))
return thing[index]
transitions = np.array([
generate(
[c1,pickone(successors(c1,width,height))],width,height)
for c1 in configs ])
else:
transitions = np.array([ generate([c1,c2],width,height)
for c1 in configs for c2 in successors(c1,width,height) ])
return np.einsum('ab...->ba...',transitions)
评论列表
文章目录