## Creature Project ## CSC323: Group 1: Nora, Terian, Josh, and Jordan ## 4/7/10 ## rule.py: Contains methods associated with the class Rule. class Rule(): #from Predicate import Predicate '''Holds a predicate tree and instructions to execute if the predicate holds true''' def __init__(self, pred, change): '''init(): accepts a predicate and an instructions''' self.predicate = pred self.nextMove = change def apply(self, world, location): """returns a boolean, which is whether or not the predicate is true.""" self.predicate.holds(world, location) def toString(self): """returns a string representation of the rule object""" def fromString(self, astr): """sets this rule to the rule specified by the serialized string"""