def test_input(self): test = ( { 'm': -1, 'p': TORIGOS[1], 's': 'Map not initialized' }, { 'm': self.map, 'p': (-1, -1), 's': 'Location out of bounds' }, ) for i in test: try: pmap = rlfl.path_fill_map(i['m'], i['p']) except Exception as e: self.assertEqual(str(e), i['s']) self.assertEqual(str(e.__class__), "<class 'rlfl.Error'>") else: self.fail('Expected Exception: %s' % i['s']) try: pmap = rlfl.path_fill_autoexplore_map(-1) except Exception as e: self.assertEqual(str(e), 'Map not initialized') self.assertEqual(str(e.__class__), "<class 'rlfl.Error'>") else: self.fail('Expected Exception: %s' % 'Map not initialized') try: pmap = rlfl.path_fill_custom_map(-1) except Exception as e: self.assertEqual(str(e), 'Map not initialized') self.assertEqual(str(e.__class__), "<class 'rlfl.Error'>") else: self.fail('Expected Exception: %s' % 'Map not initialized') try: rlfl.path_clear_map(-1, 0) except Exception as e: self.assertEqual(str(e), 'Map not initialized') self.assertEqual(str(e.__class__), "<class 'rlfl.Error'>") else: self.fail('Expected Exception: Map not initialized')
path_map_n = rlfl.path_fill_map(example.mapnum, origin, 0.7) # Bootstrap p = example.origos[4] # Create a path at most 90 steps long TOWARDS origin path = [] for i in range(90): p = rlfl.path_step_map(example.mapnum, path_map_n, p) path.append(p) if p == origin: break example.print_map(path, example.origos[1], origin) # clear the path map rlfl.path_clear_map(example.mapnum, path_map_n) # Create a safety amp map. example.origos[6] is a point on the map # that is the origin path_map_n = rlfl.path_fill_safety_map(example.mapnum, origin, 0.7) # Bootstrap p = example.origos[4] # Create a path at most 90 steps long TOWARDS origin path = [] for i in range(90): p = rlfl.path_step_map(example.mapnum, path_map_n, p) path.append(p) example.print_map(path, example.origos[4], example.origos[6])