import * from zerolife class Rule(): '''A rule class: holds a predicate and a list of actions to execute if the predicate holds true''' def __init__(self, pred, instruction): '''init(): accepts a predicate and an action''' self.Predicate = pred self.Instructions = instruction def holds(self, board, coordinates): '''If the predicate resolves as true, returns true, otherwise returns false.''' if self.Predicate.holds(self): return True else: return False def getInstructions(self): '''packs instruction object''' self.packedInstructions = [] for each i in Instructions: packedInstructions.append(instruction.pack(coordinates)) return packedInstructions