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)### ###This test is old. May 12, 2010### #make species dead = Species("dead","black") squirrel = Species("squirrel","red") #make world testWorld = LocalWorld(6,6,dead) #make predicate testPred = DirectionalTestPredicate(dead,Direction.W) testPred2 = DirectionalTestPredicate(dead, Direction.N) #make instruction testInstruc1 = Instruction(Direction.E,squirrel) testInstruc2 = Instruction(Direction.C,dead) testInstrucList = [testInstruc1, testInstruc2] #make and add rule ##if dead to left, then move left testRule = Rule(testPred,testInstrucList) testRule2 = Rule(testPred2, testInstrucList) squirrel.addRule(testRule,0) #make strength dictionary testWorld.conflictResolver.addPolicy(squirrel,dead,1) testWorld.conflictResolver.addPolicy(dead,squirrel,-1) #add species testWorld.setSpecies(4,2,squirrel) #test the save_the_world function print(testWorld.save_the_world()) #step world #print(testWorld) #testWorld.step() #print(testWorld) #testWorld.step() #print(testWorld)