from LocalWorld import LocalWorld import Direction from Species import Species from Instruction import Instruction from ConflictResolutionPolicy import ConflictResolutionPolicy from Rule import Rule from Predicate import * ###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 testPred1 = DirectionalTestPredicate(dead,Direction.W) testPred2 = QuantityPredicate(squirrel,2) testPredOr = OrPredicate([testPred1,testPred2]) #make instruction testInstruc1 = Instruction(Direction.S,squirrel) testInstruc2 = Instruction(Direction.C,dead) testInstrucList = [testInstruc1, testInstruc2] #make and add rule ##if dead to left, then move left testRule = Rule(testPredOr,testInstrucList) squirrel.addRule(testRule,0) #make strength dictionary testWorld.conflictResolver.addPolicy(squirrel,dead,1) testWorld.conflictResolver.addPolicy(dead,squirrel,-1) #add species testWorld.setSpecies(2,2,squirrel) testWorld.setSpecies(4,2,squirrel) testWorld.setSpecies(3,2,squirrel) #step world print(testWorld) testWorld.step() print(testWorld) testWorld.step() print(testWorld) testWorld.step() print(testWorld) testWorld.step() print(testWorld) testWorld.step() print(testWorld)