def test_GetAntWorldImage_NoObs_Center_2(self): mazeparser = DIYMazeParser(5) mazeparser.SetExits([Position(4, 4)]) mazefacade = MazeFacade(mazeparser) WorldImageProvider = SimpleWorldImageProvider(self.__Config, mazefacade) ant = RemoteControlledAnt(1, self.__Config) ant.UpdatePosition(position=Position(2, 1)) antworldimage = WorldImageProvider.GetAntWorldImage(ant) self.assertTrue(len(antworldimage.VisibleNodes) == 20)
def test_UpdateStep_SeeObs(self): mazeparser = DIYMazeParser(5) mazeparser.SetExits([Position(4, 4)]) mazeparser.SetObs([Position(3, 3)]) mazefacade = MazeFacade(mazeparser) WorldImageProvider = SimpleWorldImageProvider(self.__Config, mazefacade) ant = RemoteControlledAnt(1, self.__Config) ant.UpdatePosition(position=Position(4, 4)) WorldImageProvider.ProcessStep(ant, AntStep(1, Position(4, 4))) WorldImageProvider.UpdatePositionsAccordingToMoves() antworldimage = WorldImageProvider.GetAntWorldImage(ant) obsList = list( filter(lambda x: x.NodeState == NodeStateEnum.Obs, antworldimage.VisibleNodes)) self.assertTrue(len(obsList) == 1)
def GetAntsController(configprovider, maze, baseTestFolder): metadataconsumer = AntsMetaDataConsumerWrapper(configprovider) server_comm = ServerComm(config) ant_step_processer = AntStepProcesser(config) metadataconsumer.AddConsumer( RobotMetadataConsumer(config, server_comm, ant_step_processer)) metadataconsumer.AddConsumer(LoggingAntsMetaDataConsumer(config)) #metadataconsumer.AddConsumer(DrawingMetaDataConsumer(config,CreateFolder(configprovider,baseTestFolder,"Drawing_Maze"),maze.GetEnterence())) metadataconsumer.AddConsumer( MetrySenderMetaDataConsumer(config, DummyMetaDataToNodeStateInterperter())) metadataconsumer.AddConsumer( DillAntsMetaDataConsumer( config, CreateFolder(configprovider, baseTestFolder, "Data"))) performancecounterwritter = PerofromanceWriterWrapper(configprovider) performancecounterwritter.AddWritter( LoggerPerofromanceWriter(configprovider)) performancecounterwritter.AddWritter( DillPerofromanceWriter( configprovider, CreateFolder(configprovider, baseTestFolder, "Performance"))) evaluationWrapper = EvaluationResponseWrapper(configprovider) evaluationWrapper.AddEvaluator(SimpleAntEvaluator(configprovider)) step_enabler = TimedStepEnabler( int( configprovider.GetConfigValueForSectionAndKey( "RunDefinations", "SecondsPerStep", 5))) commandreciver = CommandsReciver(configprovider) commandreciver.Start() return SimpleAntsContrller( config, maze, metadataconsumer, performancecounterwritter, SimpleWorldImageProvider(config, maze, commandreciver), RobotAntProducer(configprovider, maze.GetEnterence(), server_comm=server_comm), evaluationWrapper)
def GetAntsController(self, configprovider, maze): metadataconsumer = AntsMetaDataConsumerWrapper(configprovider) metadataconsumer.AddConsumer( LoggingAntsMetaDataConsumer(configprovider)) #metadataconsumer.AddConsumer(DrawingMetaDataConsumer(configprovider)) metadataconsumer.AddConsumer( DillAntsMetaDataConsumer( configprovider, self.CreateFolder(self._basicrunfolder, "Data"))) performancecounterwritter = PerofromanceWriterWrapper(configprovider) performancecounterwritter.AddWritter( LoggerPerofromanceWriter(configprovider)) performancecounterwritter.AddWritter( DillPerofromanceWriter( configprovider, self.CreateFolder(self._basicrunfolder, "Performance"))) evaluationWrapper = EvaluationResponseWrapper(configprovider) evaluationWrapper.AddEvaluator(SimpleAntEvaluator(configprovider)) return SimpleAntsContrller( configprovider, maze, metadataconsumer, performancecounterwritter, SimpleWorldImageProvider(configprovider, maze), SimpleAntProducer(configprovider, maze.GetEnterence()), evaluationWrapper)