pyg.clock.unschedule(cell_action) pyg.clock.unschedule(update_product_count) action_scheduled = False def remove_label(time, label): cell_labels_list[0] = hld = pyg.text.Label(" ") #Setting up the environment including the products myurn = AC_Products.Urn(URN+"-"+REPRO, TYPES, RNG,INITIAL_ENERGY, PRODUCT_COUNT) # Creating all of the rules myrules = AC_ProductRules.create_RuleSet(CHEM,TYPES, RULE_COUNT, RNG) #Creating a network object for compatible rules myRuleNet = AC_ProductRuleNet.ProductRuleNet() # creating the actual cells with Sprites cell_image = image.load("cell.png") cells = [] cell_radius = .005 for i in range(20): sprite = cell_Sprite(cell_image,cell_batch, str(i+1)) sprite.scale = 3./ (space_width) sprite.color = (150,150,150) cell_list.append(sprite)
sprite.scale = 3.25/VARS.SPACE_WIDTH sprites.append(sprite) new_cell = AC_Cells.Cell(i+1, sprite, VARS) cells.append(new_cell) sprite.add_cell(new_cell) VARS.CELLS = cells VARS.SPRITES = sprites # Creating a network of neighbors on torus grid VARS.SPACE = AC_Space.Space(VARS) # Creating all of the rules and # passing out to cells at random rules = AC_ProductRules.create_RuleSet(VARS) VARS.RNG.shuffle(rules) if VARS.SIMPLE: if len(rules) == len(VARS.CELLS): for i in range(len(rules)): VARS.CELLS[i].add_ProductRule(rules[i]) else: raise ValueError("For simple cells, there must be the same number of cells and rules") else: for rule in rules: cell = VARS.RNG.choice(VARS.CELLS) cell.add_ProductRule(rule) for cell in VARS.CELLS: