from LocalWorld import LocalWorld from Predicate import * import Direction from Species import Species from Instruction import Instruction from ConflictResolutionPolicy import ConflictResolutionPolicy from Rule import Rule ###NOTE: New tests should probably go in UnitTests.py### ###These tests are old (although they still work)### #make species dead = Species("dead","black") squirrel = Species("squirrel","red") #make world testWorld = LocalWorld(6,6,dead) #make predicate testPred = QuantityPredicate(squirrel, 2) testPred2 = DirectionalTestPredicate(squirrel, Direction.NW) ComboPred = AndPredicate([testPred, testPred2]) #make instruction testInstruc1 = Instruction(Direction.W,squirrel) testInstruc2 = Instruction(Direction.C,dead) testInstrucList = [testInstruc1, testInstruc2] #make and add rule ##if dead to left, then move left testRule = Rule(ComboPred,testInstrucList) squirrel.addRule(testRule,0) #make strength dictionary testWorld.conflictResolver.addPolicy(squirrel,dead,1) testWorld.conflictResolver.addPolicy(dead,squirrel,-1) #add species testWorld.setSpecies(3,2,squirrel) testWorld.setSpecies(4,3,squirrel) testWorld.setSpecies(3,4,squirrel) #step world print(testWorld) testWorld.step() print(testWorld) testWorld.step() print(testWorld)