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)