Exemple #1
0
 def test_step_input(self):
     return
     pm = rlfl.path_fill_map(self.map, TORIGOS[1])
     test = (
         {
             'm': -1,
             'x': pm,
             'p': TORIGOS[1],
             's': 'Map not initialized'
         },
         {
             'm': self.map,
             'x': pm,
             'p': (-1, -1),
             's': 'Location out of bounds'
         },
         {
             'm': self.map,
             'x': -1,
             'p': TORIGOS[1],
             's': 'Uninitialized pathmap used'
         },
     )
     for i in test:
         try:
             pmap = rlfl.path_step_map(i['m'], i['x'], 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'])
Exemple #2
0
 example.create_map('pmap')
 
 # Define origin
 origin = example.origos[6]
 
 # Create a path map. example.origos[6] is a point on the map
 # that is the origin
 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]